Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,27 +5,22 @@ from tensorflow.keras.models import load_model
|
|
| 5 |
import tensorflow as tf
|
| 6 |
import pickle
|
| 7 |
|
| 8 |
-
# Load the LabelEncoder
|
| 9 |
with open('label_encoder.pkl', 'rb') as f:
|
| 10 |
label_encoder = pickle.load(f)
|
| 11 |
|
| 12 |
-
# Assuming 'ct' is your ColumnTransformer (replace this with the actual loading code for your preprocessor)
|
| 13 |
-
# If you have a preprocessor file (such as a pickle file), you can load it here, e.g.,
|
| 14 |
-
# with open('column_transformer.pkl', 'rb') as f:
|
| 15 |
-
# ct = pickle.load(f)
|
| 16 |
-
|
| 17 |
# UI Components for user input
|
| 18 |
input_Gender = gr.Radio(["male", "female"], label="Gender")
|
| 19 |
-
input_Race = gr.Dropdown(
|
| 20 |
-
input_Age = gr.Dropdown(
|
| 21 |
input_Height = gr.Number(label='Height (cm)')
|
| 22 |
input_Weight = gr.Number(label='Weight (kg)')
|
| 23 |
input_Diabetes = gr.Radio([0.0, 1.0], label='Diabetes')
|
| 24 |
input_Simvastatin = gr.Radio([0.0, 1.0], label='Simvastatin (Zocor)')
|
| 25 |
input_Amiodarone = gr.Radio([0.0, 1.0], label='Amiodarone (Cordarone)')
|
| 26 |
input_INR_reported = gr.Number(label='INR on Reported Therapeutic Dose of Warfarin')
|
| 27 |
-
input_Cyp2C9_genotypes = gr.Dropdown(
|
| 28 |
-
input_VKORC1_genotypes = gr.Radio(
|
| 29 |
input_model = gr.Dropdown(['Decision Tree Regression', 'Support Vector Regression', 'Random Forest Regression', 'Deep Learning'], label='Model Selection')
|
| 30 |
|
| 31 |
# Output textbox to display predicted dose
|
|
|
|
| 5 |
import tensorflow as tf
|
| 6 |
import pickle
|
| 7 |
|
| 8 |
+
# Load the LabelEncoder and ColumnTransformer before prediction
|
| 9 |
with open('label_encoder.pkl', 'rb') as f:
|
| 10 |
label_encoder = pickle.load(f)
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# UI Components for user input
|
| 13 |
input_Gender = gr.Radio(["male", "female"], label="Gender")
|
| 14 |
+
input_Race = gr.Dropdown([], label="Race") # Use empty list as placeholder
|
| 15 |
+
input_Age = gr.Dropdown([], label='Age') # Use empty list as placeholder
|
| 16 |
input_Height = gr.Number(label='Height (cm)')
|
| 17 |
input_Weight = gr.Number(label='Weight (kg)')
|
| 18 |
input_Diabetes = gr.Radio([0.0, 1.0], label='Diabetes')
|
| 19 |
input_Simvastatin = gr.Radio([0.0, 1.0], label='Simvastatin (Zocor)')
|
| 20 |
input_Amiodarone = gr.Radio([0.0, 1.0], label='Amiodarone (Cordarone)')
|
| 21 |
input_INR_reported = gr.Number(label='INR on Reported Therapeutic Dose of Warfarin')
|
| 22 |
+
input_Cyp2C9_genotypes = gr.Dropdown([], label='Cyp2C9 genotypes') # Use empty list as placeholder
|
| 23 |
+
input_VKORC1_genotypes = gr.Radio([], label='VKORC1 genotypes') # Use empty list as placeholder
|
| 24 |
input_model = gr.Dropdown(['Decision Tree Regression', 'Support Vector Regression', 'Random Forest Regression', 'Deep Learning'], label='Model Selection')
|
| 25 |
|
| 26 |
# Output textbox to display predicted dose
|