Spaces:
Sleeping
Sleeping
Commit
·
adc548e
1
Parent(s):
77a513c
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,18 @@ repo_path = username+ '/' + repo_name + '/' + save_file_name
|
|
| 12 |
|
| 13 |
xgb_loaded = joblib.load(save_file_name)
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
demo = gr.Interface(
|
| 17 |
predict_death_event,
|
|
|
|
| 12 |
|
| 13 |
xgb_loaded = joblib.load(save_file_name)
|
| 14 |
|
| 15 |
+
def predict_death_event_basic(sample):
|
| 16 |
+
result = xgb_loaded.predict(sample)
|
| 17 |
+
return result
|
| 18 |
+
|
| 19 |
+
def predict_death_event(age, anaemia, creatinine_phosphokinase, diabetes, ejection_fraction, high_blood_pressure, platelets, serum_creatinine, serum_sodium, sex, smoking, time):
|
| 20 |
+
try:
|
| 21 |
+
result = predict_death_event_basic([[age, anaemia, creatinine_phosphokinase, diabetes, ejection_fraction, high_blood_pressure, platelets, serum_creatinine, serum_sodium, sex, smoking, time]])
|
| 22 |
+
print('age ', age, 'anaemia ', anaemia, 'creatinine_phosphokinase ', creatinine_phosphokinase, 'diabetes ', diabetes, 'ejection_fraction ', ejection_fraction, 'high_blood_pressure ', high_blood_pressure, 'platelets ', platelets, 'serum_creatinine ', serum_creatinine, 'serum_sodium ', serum_sodium, 'sex ', sex, 'smoking ', smoking, 'time ', time)
|
| 23 |
+
except:
|
| 24 |
+
return 'age ', age, 'anaemia ', anaemia, 'creatinine_phosphokinase ', creatinine_phosphokinase, 'diabetes ', diabetes, 'ejection_fraction ', ejection_fraction, 'high_blood_pressure ', high_blood_pressure, 'platelets ', platelets, 'serum_creatinine ', serum_creatinine, 'serum_sodium ', serum_sodium, 'sex ', sex, 'smoking ', smoking, 'time ', time
|
| 25 |
+
return result
|
| 26 |
+
|
| 27 |
|
| 28 |
demo = gr.Interface(
|
| 29 |
predict_death_event,
|