Esmaeilkiani commited on
Commit
8242ea4
·
verified ·
1 Parent(s): 2a42813

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -0
app.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import plotly.graph_objs as go
4
+
5
+ # عنوان برنامه
6
+ st.set_page_config(page_title='اداره زراعت و کنترل محصول', layout='wide')
7
+
8
+ st.title('اداره زراعت و کنترل محصول')
9
+
10
+ # آپلود فایل
11
+ uploaded_file = st.file_uploader("لطفا فایل Excel خود را آپلود کنید", type=["xlsx", "xls"])
12
+
13
+ if uploaded_file is not None:
14
+ # خواندن داده‌ها از فایل اکسل
15
+ df = pd.read_excel(uploaded_file, sheet_name=0)
16
+
17
+ st.write("داده‌های بارگذاری شده:")
18
+ st.dataframe(df)
19
+
20
+ # نمودار سه بعدی
21
+ st.subheader("نمودار سه بعدی رشد مزارع")
22
+
23
+ fig = go.Figure(data=[go.Scatter3d(
24
+ x=df['Week'],
25
+ y=df['Height'],
26
+ z=df['Growth'],
27
+ mode='markers',
28
+ marker=dict(
29
+ size=8,
30
+ color=df['Height'], # set color to an array/list of desired values
31
+ colorscale='Viridis', # choose a colorscale
32
+ opacity=0.8
33
+ )
34
+ )])
35
+
36
+ fig.update_layout(scene=dict(
37
+ xaxis_title='Week',
38
+ yaxis_title='Height',
39
+ zaxis_title='Growth'
40
+ ))
41
+
42
+ st.plotly_chart(fig)
43
+
44
+ # تحلیل داده‌ها
45
+ st.subheader("گزارش تحلیلی")
46
+ average_height = df['Height'].mean()
47
+ average_growth = df['Growth'].mean()
48
+
49
+ st.markdown(f"* **میانگین ارتفاع:** {average_height:.2f} سانتیمتر")
50
+ st.markdown(f"* **میانگین رشد:** {average_growth:.2f} سانتیمتر")