Commit
·
3fdbadf
1
Parent(s):
9c434ba
Upload 3 files
Browse files- app.py +54 -0
- requirements.txt +7 -0
- xgboost-model.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import joblib
|
| 5 |
+
import matplotlib.pyplot as plt
|
| 6 |
+
from sklearn.model_selection import train_test_split
|
| 7 |
+
from sklearn.metrics import accuracy_score, f1_score
|
| 8 |
+
from xgboost import XGBClassifier
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
username = "mohansathya"
|
| 12 |
+
repo_name = "heartdisease"
|
| 13 |
+
save_file_name = "xgboost-model.pkl"
|
| 14 |
+
repo_path = username+ '/' + repo_name + '/' + save_file_name
|
| 15 |
+
|
| 16 |
+
xgb_loaded = joblib.load(repo_path)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
demo = gr.Interface(
|
| 20 |
+
predict_death_event,
|
| 21 |
+
[
|
| 22 |
+
gr.Slider(40, 100, value=60, label="age", info="Choose between 40 and 100"),
|
| 23 |
+
gr.Radio(
|
| 24 |
+
["No", "Yes"], type = 'index', value='Yes', label="anaemia", info="is anemic"
|
| 25 |
+
),
|
| 26 |
+
gr.Slider(23, 1300, value=588, label="creatinine_phosphokinase", info="Choose between 23 and 1300"),
|
| 27 |
+
gr.Radio(
|
| 28 |
+
["No", "Yes"], type = 'index', value='Yes', label="diabetes", info="is diabetic"
|
| 29 |
+
),
|
| 30 |
+
gr.Slider(14, 70, value=60, label="ejection_fraction", info="Choose between 14 and 70"),
|
| 31 |
+
gr.Radio(
|
| 32 |
+
["No", "Yes"], type = 'index', value='No', label="high_blood_pressure", info="is hypertensive"
|
| 33 |
+
),
|
| 34 |
+
gr.Slider(70000, 450000, value=194000, label="platelets", info="Choose between 70000 and 450000"),
|
| 35 |
+
gr.Slider(0.5, 2.2, value=194000, label="serum_creatinine", info="Choose between 0.5 and 2.2"),
|
| 36 |
+
gr.Slider(120, 150, value=142, label="serum_sodium", info="Choose between 120 and 150"),
|
| 37 |
+
gr.Radio(
|
| 38 |
+
["No", "Yes"], type = 'index', value='No', label="Is woman", info="is woman"
|
| 39 |
+
),
|
| 40 |
+
gr.Radio(
|
| 41 |
+
["No", "Yes"], type = 'index', value='No', label="Is a smoker?", info="is smoker?"
|
| 42 |
+
),
|
| 43 |
+
gr.Slider(1, 300, value=33, label="follow-up period", info="Choose between 1 and 300 days")
|
| 44 |
+
],
|
| 45 |
+
"text",
|
| 46 |
+
examples=[
|
| 47 |
+
[6.00e+01, 'Yes', 5.88e+02, 'Yes', 6.00e+01, 'No',
|
| 48 |
+
1.94e+05, 1.10e+00, 1.42e+02, 'No', 'No', 3.30e+01],
|
| 49 |
+
[5.30e+01, 'Yes', 2.70e+02, 'Yes', 3.50e+01, 'No',
|
| 50 |
+
2.27e+05, 2.15e+00, 1.45e+02, 'Yes', 'No', 1.05e+02]
|
| 51 |
+
]
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
demo.launch(debug = True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
numpy
|
| 2 |
+
pandas
|
| 3 |
+
joblib
|
| 4 |
+
matplotlib
|
| 5 |
+
sklearn
|
| 6 |
+
xgboost
|
| 7 |
+
gradio
|
xgboost-model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14c0d2599174830ec5a9052af2a416a00ef52c7e61b44844bf32c833cdb6de7f
|
| 3 |
+
size 189168
|