V8055 commited on
Commit
3d2bdb5
·
verified ·
1 Parent(s): 835a004

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -84,20 +84,13 @@ class IrisPredictor:
84
  labels={'x': 'Features', 'y': 'Importance'})
85
  return fig
86
 
87
- def predict_single_sample(self, model, features):
88
- # Ensure scaler is fitted
89
- if not hasattr(self.scaler, "mean_"):
90
- raise RuntimeError("The scaler is not fitted. Please train the model first.")
91
-
92
- # Scale features
93
- scaled_features = self.scaler.transform([features])
94
-
95
- # Make prediction
96
- prediction = model.predict(scaled_features)
97
- probabilities = model.predict_proba(scaled_features)
98
-
99
- return prediction[0], probabilities[0]
100
-
101
 
102
  def main():
103
  st.title("🌸 Iris Flower Prediction App")
 
84
  labels={'x': 'Features', 'y': 'Importance'})
85
  return fig
86
 
87
+ def predict_single_sample(self, model, features):
88
+ # Scale features
89
+ scaled_features = self.scaler.transform([features])
90
+ # Make prediction
91
+ prediction = model.predict(scaled_features)
92
+ probabilities = model.predict_proba(scaled_features)
93
+ return prediction[0], probabilities[0]
 
 
 
 
 
 
 
94
 
95
  def main():
96
  st.title("🌸 Iris Flower Prediction App")