Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,8 +17,16 @@ def predict_alzheimers(age, gender, bmi, smoking, alcohol, diabetes, hypertensio
|
|
| 17 |
apoe4 = 1 if apoe4 == "Yes" else 0
|
| 18 |
|
| 19 |
features = np.array([[age, gender, bmi, smoking, alcohol, diabetes, hypertension, family_history, cognitive_score, apoe4]])
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Gradio UI
|
| 24 |
interface = gr.Interface(
|
|
|
|
| 17 |
apoe4 = 1 if apoe4 == "Yes" else 0
|
| 18 |
|
| 19 |
features = np.array([[age, gender, bmi, smoking, alcohol, diabetes, hypertension, family_history, cognitive_score, apoe4]])
|
| 20 |
+
|
| 21 |
+
# Get probability of Alzheimer's positive (class 1)
|
| 22 |
+
proba = model.predict_proba(features)[0][1]
|
| 23 |
+
proba_percent = round(proba * 100, 2)
|
| 24 |
+
|
| 25 |
+
if proba >= 0.5:
|
| 26 |
+
return f"🧠 Likely Alzheimer’s Positive ({proba_percent}%)"
|
| 27 |
+
else:
|
| 28 |
+
return f"✅ Likely Alzheimer’s Negative ({100 - proba_percent}%)"
|
| 29 |
+
|
| 30 |
|
| 31 |
# Gradio UI
|
| 32 |
interface = gr.Interface(
|