Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import pickle
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
# Cargar el modelo y el vectorizador
|
| 5 |
with open('models/risk-model.pck', 'rb') as f:
|
| 6 |
dv, model = pickle.load(f)
|
| 7 |
|
|
@@ -38,7 +37,6 @@ def predict_risk(
|
|
| 38 |
"medical_unit": medical_unit,
|
| 39 |
}
|
| 40 |
|
| 41 |
-
# Predecir el riesgo con el modelo
|
| 42 |
risk, prediction = predict_single(customer, dv, model)
|
| 43 |
|
| 44 |
return {
|
|
@@ -54,6 +52,7 @@ with gr.Blocks() as interface:
|
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column():
|
|
|
|
| 57 |
sex = gr.Dropdown(
|
| 58 |
choices=["Femenino", "Masculino"],
|
| 59 |
label="Sexo",
|
|
@@ -76,9 +75,10 @@ with gr.Blocks() as interface:
|
|
| 76 |
maximum=3,
|
| 77 |
info="1-3 means the patient was diagnosed with COVID; 4+ means not diagnosed.",
|
| 78 |
)
|
| 79 |
-
patient_type = gr.
|
| 80 |
-
choices=[1, 2],
|
| 81 |
label="Patient Type",
|
|
|
|
| 82 |
interactive=True,
|
| 83 |
info="1 for Returned Home, 2 for Hospitalization",
|
| 84 |
)
|
|
@@ -130,4 +130,4 @@ with gr.Blocks() as interface:
|
|
| 130 |
)
|
| 131 |
|
| 132 |
if __name__ == "__main__":
|
| 133 |
-
interface.launch()
|
|
|
|
| 1 |
import pickle
|
| 2 |
import gradio as gr
|
| 3 |
|
|
|
|
| 4 |
with open('models/risk-model.pck', 'rb') as f:
|
| 5 |
dv, model = pickle.load(f)
|
| 6 |
|
|
|
|
| 37 |
"medical_unit": medical_unit,
|
| 38 |
}
|
| 39 |
|
|
|
|
| 40 |
risk, prediction = predict_single(customer, dv, model)
|
| 41 |
|
| 42 |
return {
|
|
|
|
| 52 |
|
| 53 |
with gr.Row():
|
| 54 |
with gr.Column():
|
| 55 |
+
gr.Markdown("### Inputs")
|
| 56 |
sex = gr.Dropdown(
|
| 57 |
choices=["Femenino", "Masculino"],
|
| 58 |
label="Sexo",
|
|
|
|
| 75 |
maximum=3,
|
| 76 |
info="1-3 means the patient was diagnosed with COVID; 4+ means not diagnosed.",
|
| 77 |
)
|
| 78 |
+
patient_type = gr.Dropdown(
|
| 79 |
+
choices=["1", "2"],
|
| 80 |
label="Patient Type",
|
| 81 |
+
value="1",
|
| 82 |
interactive=True,
|
| 83 |
info="1 for Returned Home, 2 for Hospitalization",
|
| 84 |
)
|
|
|
|
| 130 |
)
|
| 131 |
|
| 132 |
if __name__ == "__main__":
|
| 133 |
+
interface.launch()
|