Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,6 @@ import pandas as pd
|
|
4 |
import numpy as np
|
5 |
|
6 |
|
7 |
-
def greet(name):
|
8 |
-
return "Hello " + name + "!!"
|
9 |
-
|
10 |
def predicter(SpO2, Age, Weight, Height, Temperature, Gender, Race):
|
11 |
xgb_reg = xgboost.XGBClassifier(tree_method = 'approx',
|
12 |
enable_categorical = True,
|
@@ -28,14 +25,16 @@ def predicter(SpO2, Age, Weight, Height, Temperature, Gender, Race):
|
|
28 |
|
29 |
user_input = pd.DataFrame([[SpO2/100,Age/91,Weight/309,Height/213,Temperature/42.06,gen,Race]],columns = cont_features+cat_features)
|
30 |
user_input[cat_features] = user_input[cat_features].copy().astype('category')
|
31 |
-
pred = xgb_reg.
|
32 |
|
33 |
-
return pred
|
|
|
34 |
|
35 |
|
36 |
demo = gr.Interface(
|
37 |
fn=predicter,
|
38 |
inputs=[gr.Slider(0, 100),"number",gr.inputs.Number(label = "Weight in kg"),gr.inputs.Number(label = "Height in cm"),gr.inputs.Number(label = "Temperature in Celcius"),gr.Radio(["Male", "Female"]),gr.Radio(["White", "Black", "Asian", "Hispanic", "Other"])],
|
39 |
-
outputs=
|
|
|
40 |
)
|
41 |
demo.launch()
|
|
|
4 |
import numpy as np
|
5 |
|
6 |
|
|
|
|
|
|
|
7 |
def predicter(SpO2, Age, Weight, Height, Temperature, Gender, Race):
|
8 |
xgb_reg = xgboost.XGBClassifier(tree_method = 'approx',
|
9 |
enable_categorical = True,
|
|
|
25 |
|
26 |
user_input = pd.DataFrame([[SpO2/100,Age/91,Weight/309,Height/213,Temperature/42.06,gen,Race]],columns = cont_features+cat_features)
|
27 |
user_input[cat_features] = user_input[cat_features].copy().astype('category')
|
28 |
+
pred = xgb_reg.predict_proba(user_input)
|
29 |
|
30 |
+
return return {"Probability of Not Being Hidden Hypoxemic": pred[0][0],
|
31 |
+
"Probability of Having Hidden Hypoxemia": pred[0][1], }
|
32 |
|
33 |
|
34 |
demo = gr.Interface(
|
35 |
fn=predicter,
|
36 |
inputs=[gr.Slider(0, 100),"number",gr.inputs.Number(label = "Weight in kg"),gr.inputs.Number(label = "Height in cm"),gr.inputs.Number(label = "Temperature in Celcius"),gr.Radio(["Male", "Female"]),gr.Radio(["White", "Black", "Asian", "Hispanic", "Other"])],
|
37 |
+
outputs=gr.outputs.Label(num_top_classes=2),
|
38 |
+
title = "Probability of Hidden Hypoxemia"
|
39 |
)
|
40 |
demo.launch()
|