import streamlit as st import pandas as pd import plotly.express as px import plotly.graph_objs as go from data_processing import process_file from ml_model import predict_yield # Title of the dashboard st.title('Sugarcane Yield Prediction Dashboard') # File upload uploaded_file = st.file_uploader("Upload your crop log data", type=["csv", "xlsx", "pdf", "tiff"]) # Check if file is uploaded if uploaded_file is not None: data = process_file(uploaded_file) if data is not None: st.write("Data Preview:") st.dataframe(data.head()) # Machine Learning predictions predictions = predict_yield(data) data['Predicted Yield'] = predictions st.write("Predicted Yield:") st.dataframe(data[['feature1', 'feature2', 'Predicted Yield']]) # 3D Visualization fig_hist = px.histogram(data, x='Predicted Yield', nbins=30, title='3D Histogram') fig_hist.update_traces(marker=dict(colorscale='Viridis', reversescale=True)) st.plotly_chart(fig_hist) fig_surf = go.Figure(data=[go.Surface(z=data[['feature1', 'feature2', 'Predicted Yield']].values)]) fig_surf.update_layout(title='3D Surface Plot', autosize=True) st.plotly_chart(fig_surf) else: st.error("Error processing file.") else: st.write("Please upload a file to proceed.")