Spaces:
Runtime error
Runtime error
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*") |