Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,6 +32,7 @@ height = gr.Number(label="Height")
|
|
32 |
diabetes = gr.Radio(["0.0", "1.0"], label="Diabetes")
|
33 |
simvastatin = gr.Radio(["0.0", "1.0"], label="Simvastatin")
|
34 |
amiodarone = gr.Radio(["0.0", "1.0"], label="Amiodarone")
|
|
|
35 |
INR_reported = gr.Number(label="INR on Reported Therapeutic Dose of Warfarin")
|
36 |
cyp2C9_genotypes = gr.Dropdown(choices=list(cyp2C9_genotypes_dict.keys()), label="Cyp2C9 genotypes")
|
37 |
VKORC1_genotype = gr.Dropdown(choices=list(VKORC1_genotype_dict.keys()), label="VKORC1 genotype")
|
@@ -39,7 +40,7 @@ model = gr.Dropdown(choices=["Linear Regression", "Ridge Regression", "Decision
|
|
39 |
|
40 |
|
41 |
# Modify the gender encoding and ensure all categorical variables are properly encoded
|
42 |
-
def multi_inputs(age, gender, race, weight, height, diabetes, simvastatin, amiodarone, INR_reported, cyp2C9_genotypes, VKORC1_genotype, model, dose):
|
43 |
# Load the appropriate model based on the selected model
|
44 |
if model == 'Linear Regression':
|
45 |
model = load('Linear_regressor_model.pkl')
|
@@ -65,7 +66,7 @@ def multi_inputs(age, gender, race, weight, height, diabetes, simvastatin, amiod
|
|
65 |
VKORC1_genotype_encoded = VKORC1_genotype_dict.get(VKORC1_genotype)
|
66 |
|
67 |
# Transform input data
|
68 |
-
inputs = [
|
69 |
|
70 |
# Predict therapeutic dose of warfarin
|
71 |
input_data = np.array([inputs])
|
@@ -75,6 +76,6 @@ def multi_inputs(age, gender, race, weight, height, diabetes, simvastatin, amiod
|
|
75 |
|
76 |
|
77 |
# Create the Gradio interface
|
78 |
-
inputs = [age, gender, race, weight, height, diabetes, simvastatin, amiodarone, INR_reported, cyp2C9_genotypes, VKORC1_genotype, model]
|
79 |
outputs = gr.Textbox(label="Predicted Therapeutic Dose of Warfarin")
|
80 |
gr.Interface(fn=multi_inputs, inputs=inputs, outputs=outputs).launch(share=True, debug=True)
|
|
|
32 |
diabetes = gr.Radio(["0.0", "1.0"], label="Diabetes")
|
33 |
simvastatin = gr.Radio(["0.0", "1.0"], label="Simvastatin")
|
34 |
amiodarone = gr.Radio(["0.0", "1.0"], label="Amiodarone")
|
35 |
+
Target_INR=gr.Number(label="Target INR")
|
36 |
INR_reported = gr.Number(label="INR on Reported Therapeutic Dose of Warfarin")
|
37 |
cyp2C9_genotypes = gr.Dropdown(choices=list(cyp2C9_genotypes_dict.keys()), label="Cyp2C9 genotypes")
|
38 |
VKORC1_genotype = gr.Dropdown(choices=list(VKORC1_genotype_dict.keys()), label="VKORC1 genotype")
|
|
|
40 |
|
41 |
|
42 |
# Modify the gender encoding and ensure all categorical variables are properly encoded
|
43 |
+
def multi_inputs(age, gender, race, weight, height, diabetes, simvastatin, amiodarone, Target_INR, INR_reported, cyp2C9_genotypes, VKORC1_genotype, model, dose):
|
44 |
# Load the appropriate model based on the selected model
|
45 |
if model == 'Linear Regression':
|
46 |
model = load('Linear_regressor_model.pkl')
|
|
|
66 |
VKORC1_genotype_encoded = VKORC1_genotype_dict.get(VKORC1_genotype)
|
67 |
|
68 |
# Transform input data
|
69 |
+
inputs = [gender_encoded, race_encoded,age_encoded, height, weight, diabetes_encoded, simvastatin_encoded, amiodarone_encoded, Target_INR ,INR_reported, cyp2C9_genotypes_encoded, VKORC1_genotype_encoded]
|
70 |
|
71 |
# Predict therapeutic dose of warfarin
|
72 |
input_data = np.array([inputs])
|
|
|
76 |
|
77 |
|
78 |
# Create the Gradio interface
|
79 |
+
inputs = [age, gender, race, weight, height, diabetes, simvastatin, amiodarone, Target_INR, INR_reported, cyp2C9_genotypes, VKORC1_genotype, model]
|
80 |
outputs = gr.Textbox(label="Predicted Therapeutic Dose of Warfarin")
|
81 |
gr.Interface(fn=multi_inputs, inputs=inputs, outputs=outputs).launch(share=True, debug=True)
|