ready2drop commited on
Commit
56ffca6
·
verified ·
1 Parent(s): bb9eeda
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -188,7 +188,6 @@ def classify(tabular_data):
188
 
189
  Args:
190
  tabular_data (list or array-like): Input data points (e.g., a single row of features)
191
- model (object): Pre-trained classification model from PyCaret
192
 
193
  Returns:
194
  str: Classification result and probabilities
@@ -211,8 +210,18 @@ def classify(tabular_data):
211
  predicted_class = prediction.loc[0, "prediction_label"]
212
  class_probability = prediction.loc[0, "prediction_score"]
213
 
214
- # Format the result
215
- result = f"Predicted Class: {predicted_class}, Probability: {class_probability:.2f}"
 
 
 
 
 
 
 
 
 
 
216
  return result
217
 
218
  except Exception as e:
 
188
 
189
  Args:
190
  tabular_data (list or array-like): Input data points (e.g., a single row of features)
 
191
 
192
  Returns:
193
  str: Classification result and probabilities
 
210
  predicted_class = prediction.loc[0, "prediction_label"]
211
  class_probability = prediction.loc[0, "prediction_score"]
212
 
213
+ # Generate appropriate output based on the prediction
214
+ if predicted_class == 1:
215
+ result = (
216
+ f"Based on the provided data, this tool estimates a {class_probability:.2f} probability "
217
+ "of a common bile duct stone. Further medical review is necessary."
218
+ )
219
+ else:
220
+ result = (
221
+ f"This analysis estimates a {class_probability:.2f} probability that no common bile duct stone is present. "
222
+ "Please consult a medical professional for final diagnosis."
223
+ )
224
+
225
  return result
226
 
227
  except Exception as e: