import streamlit as st import pandas as pd import plotly.graph_objs as go # عنوان برنامه st.set_page_config(page_title='اداره زراعت و کنترل محصول', layout='wide') st.title('اداره زراعت و کنترل محصول') # آپلود فایل uploaded_file = st.file_uploader("لطفا فایل Excel خود را آپلود کنید", type=["xlsx", "xls"]) if uploaded_file is not None: # خواندن داده‌ها از فایل اکسل df = pd.read_excel(uploaded_file, sheet_name=0) st.write("داده‌های بارگذاری شده:") st.dataframe(df) # نمودار سه بعدی st.subheader("نمودار سه بعدی رشد مزارع") fig = go.Figure(data=[go.Scatter3d( x=df['هفته'], y=df['ارتفاع'], z=df['رشد'], mode='markers', marker=dict( size=8, color=df['ارتفاع'], # set color to an array/list of desired values colorscale='Viridis', # choose a colorscale opacity=0.8 ) )]) fig.update_layout(scene=dict( xaxis_title='هفته', yaxis_title='ارتفاع', zaxis_title='رشد' )) st.plotly_chart(fig) # تحلیل داده‌ها st.subheader("گزارش تحلیلی") average_height = df['ارتفاع'].mean() average_growth = df['رشد'].mean() # Load custom CSS def load_css(file_path): with open(file_path) as f: st.markdown(f'', unsafe_allow_html=True) load_css("styles.css") st.markdown(f"* **میانگین ارتفاع:** {average_height:.2f} سانتیمتر") st.markdown(f"* **میانگین رشد:** {average_growth:.2f} سانتیمتر")