File size: 1,589 Bytes
955b4cf
 
3694189
955b4cf
 
 
3694189
955b4cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3694189
955b4cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import streamlit as st
import pandas as pd

st.set_page_config(page_title="CropSeek LLM", layout="wide")
st.title("🌱 CropSeek LLM")
st.subheader("AI-Powered Agricultural Decision Support System")

# Chat Interface
with st.expander("Live Crop Advisor", expanded=True):
    if "messages" not in st.session_state:
        st.session_state.messages = []
    
    for message in st.session_state.messages:
        with st.chat_message(message["role"]):
            st.markdown(message["content"])
    
    if prompt := st.chat_input("Ask about crop recommendations..."):
        st.session_state.messages.append({"role": "user", "content": prompt})
        with st.chat_message("assistant"):
            response = f"Based on your inputs, I recommend **Maize** (85% confidence) and **Soybeans** (76% confidence)."
            st.markdown(response)
            st.session_state.messages.append({"role": "assistant", "content": response})

# Data Analysis Section
with st.sidebar:
    st.header("Farm Data Analysis")
    uploaded_file = st.file_uploader("Upload Soil Data (CSV)", type="csv")
    soil_type = st.selectbox("Soil Type", ["Loamy", "Clay", "Sandy"])
    climate = st.selectbox("Climate Zone", ["Tropical", "Temperate", "Arid"])
    
    if st.button("Analyze Conditions"):
        sample_data = pd.DataFrame({
            "Parameter": ["Soil Type", "Climate Zone", "Recommended Crops"],
            "Value": [soil_type, climate, "Maize, Soybeans, Wheat"]
        })
        st.dataframe(sample_data, use_container_width=True)

st.markdown("---\n*Demo for Investor Preview | v1.2*")