Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
import joblib
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
-
# Load
|
| 6 |
model = joblib.load("xgboost_model.pkl")
|
| 7 |
|
| 8 |
# 🔧 Preprocessing Function
|
|
@@ -20,7 +20,10 @@ def preprocess(age, gender, bmi, smoking, alcohol, diabetes, hypertension, famil
|
|
| 20 |
# 🧠 Prediction Function
|
| 21 |
def predict_alzheimers(age, gender, bmi, smoking, alcohol, diabetes, hypertension, family_history, cognitive_score, apoe4):
|
| 22 |
features = preprocess(age, gender, bmi, smoking, alcohol, diabetes, hypertension, family_history, cognitive_score, apoe4)
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
# Predict probability of class 1 (positive)
|
| 25 |
proba = model.predict_proba(features)[0][1]
|
| 26 |
proba_percent = round(proba * 100, 2)
|
|
|
|
| 2 |
import joblib
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
+
# Load trained model
|
| 6 |
model = joblib.load("xgboost_model.pkl")
|
| 7 |
|
| 8 |
# 🔧 Preprocessing Function
|
|
|
|
| 20 |
# 🧠 Prediction Function
|
| 21 |
def predict_alzheimers(age, gender, bmi, smoking, alcohol, diabetes, hypertension, family_history, cognitive_score, apoe4):
|
| 22 |
features = preprocess(age, gender, bmi, smoking, alcohol, diabetes, hypertension, family_history, cognitive_score, apoe4)
|
| 23 |
+
|
| 24 |
+
# Debug: print features being sent to model
|
| 25 |
+
print("🛠️ Processed input sent to model:", features)
|
| 26 |
+
|
| 27 |
# Predict probability of class 1 (positive)
|
| 28 |
proba = model.predict_proba(features)[0][1]
|
| 29 |
proba_percent = round(proba * 100, 2)
|