Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,6 +68,17 @@ avg_temp=st.slider('Slide The value to get Avg Temperature',min_value=1,max_valu
|
|
| 68 |
model=joblib.load("model_rf.joblib")
|
| 69 |
|
| 70 |
if st.button("Enter"):
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
model=joblib.load("model_rf.joblib")
|
| 69 |
|
| 70 |
if st.button("Enter"):
|
| 71 |
+
try:
|
| 72 |
+
# Prepare input for the model
|
| 73 |
+
input_features = [[Area_value, Item_value, avg_rainfall, pes_tonnes, avg_temp]]
|
| 74 |
+
|
| 75 |
+
# Get prediction from the model
|
| 76 |
+
output = model.predict(input_features)[0]
|
| 77 |
+
|
| 78 |
+
# Display the result with styling
|
| 79 |
+
st.success(f"🌱 The predicted **hg/ha_yield** is: **{output:.2f}**")
|
| 80 |
|
| 81 |
+
except Exception as e:
|
| 82 |
+
st.error(f"⚠️ Error in prediction: {e}")
|
| 83 |
+
|
| 84 |
+
st.write("")
|