Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ coordinates = (selected_farm_data['longitude'].iloc[0], selected_farm_data['lati
|
|
60 |
if st.button('نمایش نقشه NDRE'):
|
61 |
NDRE = calculate_ndre(coordinates, start_date, end_date)
|
62 |
if NDRE is not None:
|
63 |
-
st.session_state.ndre_value = NDRE
|
64 |
st.write(f'شاخص NDRE: {NDRE}')
|
65 |
|
66 |
Map = geemap.Map()
|
@@ -73,8 +73,18 @@ if st.button('نمایش نقشه NDRE'):
|
|
73 |
st.error("Unable to calculate NDRE.")
|
74 |
|
75 |
if st.button("Predict"):
|
76 |
-
|
|
|
77 |
user_input = pd.DataFrame({
|
78 |
'Farm_Name': [selected_farm],
|
79 |
'Farm_Age': [farm_age],
|
80 |
-
'Farm_Variety': [farm_variety],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
if st.button('نمایش نقشه NDRE'):
|
61 |
NDRE = calculate_ndre(coordinates, start_date, end_date)
|
62 |
if NDRE is not None:
|
63 |
+
st.session_state.ndre_value = NDRE # Store NDRE in session state
|
64 |
st.write(f'شاخص NDRE: {NDRE}')
|
65 |
|
66 |
Map = geemap.Map()
|
|
|
73 |
st.error("Unable to calculate NDRE.")
|
74 |
|
75 |
if st.button("Predict"):
|
76 |
+
# Retrieve NDRE value from session state, default to 0 if not set
|
77 |
+
ndre_value = st.session_state.get('ndre_value', 0)
|
78 |
user_input = pd.DataFrame({
|
79 |
'Farm_Name': [selected_farm],
|
80 |
'Farm_Age': [farm_age],
|
81 |
+
'Farm_Variety': [farm_variety],
|
82 |
+
'NDRE': [ndre_value] # Use the retrieved NDRE value
|
83 |
+
})
|
84 |
+
|
85 |
+
# Feature Engineering might be needed here depending on your model's input features
|
86 |
+
prediction = model.predict(user_input)
|
87 |
+
|
88 |
+
st.write("Predictions:")
|
89 |
+
st.write(f"Brix: {prediction[0][0]}") # Assuming model outputs a list of lists
|
90 |
+
st.write(f"Pol:
|