Mummia-99 commited on
Commit
db96cc2
·
verified ·
1 Parent(s): a99bdb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
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
- output=model.predict([[Area_value,Item_value,avg_rainfall,pes_tonnes,avg_temp]])
 
 
 
 
 
 
 
 
72
 
73
- st.write("The value of hg/ha_yield:",output)
 
 
 
 
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("")