|
import gradio as gr |
|
import xgboost |
|
import pandas as pd |
|
import numpy as np |
|
|
|
|
|
def greet(name): |
|
return "Hello " + name + "!!" |
|
|
|
def predict(SpO2, Age, Weight, Height, Temperature, Gender, Race): |
|
xgb_reg = xgboost.XGBClassifier(tree_method = 'approx', |
|
enable_categorical = True, |
|
learning_rate=.1, |
|
max_depth=2, |
|
n_estimators=70, |
|
early_stopping_rounds = 0, |
|
scale_pos_weight=1) |
|
|
|
xgb_reg.load_model('classifier_fewer_features_HH.json') |
|
|
|
if Gender == "Male": |
|
gen = "M" |
|
elif Gender == "Female": |
|
gen = "F" |
|
|
|
|
|
user_input = pd.DataFrame([SpO2,Age,Weight,Height,Temperature,gen,Race]) |
|
|
|
return user_input['gen'] |
|
|
|
|
|
demo = gr.Interface( |
|
fn=predict, |
|
inputs=[gr.Slider(0, 100),"number",gr.inputs.Number(),"number","number",gr.Radio(["Male", "Female"]),gr.Radio(["White", "Black", "Asian", "Hispanic", "Other"])], |
|
outputs=["text"], |
|
) |
|
demo.launch() |