FabIndy commited on
Commit
e657df6
·
1 Parent(s): c4e578f

modif thresholds

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -124,9 +124,9 @@ def predict_risk(
124
  diab_prob = float(model_diab.predict_proba(row_diab[feature_cols])[0][1])
125
  chol_prob = float(model_chol.predict_proba(row_chol[feature_cols])[0][1])
126
 
127
- # Hard classification using threshold 0.5 (same as in notebooks 11 & 12)
128
- diab_class = int(diab_prob >= 0.5)
129
- chol_class = int(chol_prob >= 0.5)
130
 
131
  # Gradio HighlightedText needs a list of (text, label/color)
132
  diab_text = f"Diabetes risk: {diab_prob * 100:.1f}% — Class {diab_class}"
@@ -150,7 +150,7 @@ def predict_risk(
150
  with gr.Blocks(theme=theme, title="NHANES Health Risk Predictor") as demo:
151
  gr.Markdown(
152
  "# NHANES Health Risk Predictor\n"
153
- "### Two ML models trained on 7,000+ NHANES participants (2021–2023)\n"
154
  "---"
155
  )
156
 
 
124
  diab_prob = float(model_diab.predict_proba(row_diab[feature_cols])[0][1])
125
  chol_prob = float(model_chol.predict_proba(row_chol[feature_cols])[0][1])
126
 
127
+ # Hard classification using threshold 0.40 for diab, 0.35 for chol
128
+ diab_class = int(diab_prob >= 0.40)
129
+ chol_class = int(chol_prob >= 0.35)
130
 
131
  # Gradio HighlightedText needs a list of (text, label/color)
132
  diab_text = f"Diabetes risk: {diab_prob * 100:.1f}% — Class {diab_class}"
 
150
  with gr.Blocks(theme=theme, title="NHANES Health Risk Predictor") as demo:
151
  gr.Markdown(
152
  "# NHANES Health Risk Predictor\n"
153
+ "### Two ML models trained on 5,000+ NHANES participants (2021–2023)\n"
154
  "---"
155
  )
156