import streamlit as st import pandas as pd import numpy as np st.set_page_config(page_title="Maize Lens", layout="wide") ---------- SESSION STATE NAV ---------- if "page" not in st.session_state: st.session_state.page = "Home" ---------- STYLING ---------- st.markdown(""" """, unsafe_allow_html=True) ---------- SIDEBAR ---------- st.sidebar.title("🌽 Maize Lens") page = st.sidebar.radio("Navigation", ["Home", "Dashboard", "Prediction"], index=["Home","Dashboard","Prediction"].index(st.session_state.page)) st.session_state.page = page ---------- HOME ---------- if page == "Home": st.markdown("
🌽 Maize Lens
", unsafe_allow_html=True) st.write("### See your maize future clearly") st.image("https://images.unsplash.com/photo-1601597111158-2fceff292cdc", use_column_width=True) if st.button("Get Started"): st.session_state.page = "Dashboard" st.rerun() ---------- DASHBOARD ---------- elif page == "Dashboard": st.markdown("
Dashboard
", unsafe_allow_html=True) st.write("Welcome back!") col1, col2 = st.columns(2) col3, col4 = st.columns(2) with col1: st.markdown("
🌡️ 27°C
Temperature (7-day)
", unsafe_allow_html=True) with col2: st.markdown("
🌧️ 15 mm
Rainfall (7-day)
", unsafe_allow_html=True) with col3: st.markdown("
💧 75%
Humidity
", unsafe_allow_html=True) with col4: st.markdown("
🦠 0.9 (High)
Fungal Index
", unsafe_allow_html=True) st.markdown("### Disease Prediction") st.markdown("""
🌽 Northern Leaf Blight - High Risk

✔ Scout your field twice this week
✔ Remove heavily infected leaves
✔ Consult extension staff
""", unsafe_allow_html=True) if st.button("See Full Report"): st.info("Detailed analytics coming soon...") ---------- PREDICTION ---------- elif page == "Prediction": st.markdown("
Disease Prediction
", unsafe_allow_html=True) col1, col2 = st.columns(2) with col1: temp = st.slider("Temperature (°C)", 10, 45, 27) rainfall = st.slider("Rainfall (mm)", 0, 50, 15) with col2: humidity = st.slider("Humidity (%)", 30, 100, 75) risk_score = (temp/45) + (humidity/100) + (rainfall/50) st.markdown("### Prediction Result") if risk_score > 2: st.markdown("
High Risk - Northern Leaf Blight
", unsafe_allow_html=True) elif risk_score > 1.5: st.markdown("
Moderate Risk
", unsafe_allow_html=True) else: st.markdown("
Low Risk
", unsafe_allow_html=True) # Graph np.random.seed(42) data = pd.DataFrame({ "Day": range(1, 8), "Temperature": np.linspace(24, 32, 7), "Humidity": np.linspace(70, 80, 7) }) st.line_chart(data.set_index("Day"))