Spaces:
Build error
Build error
Commit ·
2b9bd8f
1
Parent(s): c4b9c36
changed clear button to use lambda func
Browse files
app.py
CHANGED
|
@@ -15,7 +15,16 @@ def clear_form(**args):
|
|
| 15 |
widget.reset()
|
| 16 |
return
|
| 17 |
|
| 18 |
-
def predict(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
'''
|
| 20 |
Predict the label for the data inputed
|
| 21 |
'''
|
|
@@ -72,13 +81,15 @@ def load_interface():
|
|
| 72 |
#set event listeners
|
| 73 |
inputs = [age, height, weight, waist, eye_L, eye_R, hear_L, hear_R, systolic, relaxation, fasting_blood_sugar, cholesterol, triglyceride, HDL, LDL, hemoglobin, urine_protein, serum_creatinine, AST, ALT, Gtp, dental_caries]
|
| 74 |
pred_btn.click(fn=predict, inputs=inputs, outputs=smoker_label)
|
| 75 |
-
clear_btn.click(
|
| 76 |
|
| 77 |
|
| 78 |
iface = gr.TabbedInterface( #TODO: add somewhere in the app (another tab?) information about our project: github, description, model metrics, etc.
|
| 79 |
[iface_form],
|
| 80 |
["Predict Smoker"]
|
| 81 |
)
|
|
|
|
|
|
|
| 82 |
|
| 83 |
iface_form.launch(server_name="0.0.0.0", server_port=7860)
|
| 84 |
|
|
|
|
| 15 |
widget.reset()
|
| 16 |
return
|
| 17 |
|
| 18 |
+
def predict(
|
| 19 |
+
age, height, weight,
|
| 20 |
+
waist, eye_L, eye_R,
|
| 21 |
+
hear_L, hear_R, systolic,
|
| 22 |
+
relaxation, fasting_blood_sugar, cholesterol,
|
| 23 |
+
triglyceride, HDL, LDL,
|
| 24 |
+
hemoglobin, urine_protein,
|
| 25 |
+
serum_creatinine, AST, ALT,
|
| 26 |
+
Gtp, dental_caries
|
| 27 |
+
):
|
| 28 |
'''
|
| 29 |
Predict the label for the data inputed
|
| 30 |
'''
|
|
|
|
| 81 |
#set event listeners
|
| 82 |
inputs = [age, height, weight, waist, eye_L, eye_R, hear_L, hear_R, systolic, relaxation, fasting_blood_sugar, cholesterol, triglyceride, HDL, LDL, hemoglobin, urine_protein, serum_creatinine, AST, ALT, Gtp, dental_caries]
|
| 83 |
pred_btn.click(fn=predict, inputs=inputs, outputs=smoker_label)
|
| 84 |
+
clear_btn.click(lambda: [None, 5], outputs=inputs)
|
| 85 |
|
| 86 |
|
| 87 |
iface = gr.TabbedInterface( #TODO: add somewhere in the app (another tab?) information about our project: github, description, model metrics, etc.
|
| 88 |
[iface_form],
|
| 89 |
["Predict Smoker"]
|
| 90 |
)
|
| 91 |
+
|
| 92 |
+
#TODO: include examples like here: https://www.gradio.app/docs/number
|
| 93 |
|
| 94 |
iface_form.launch(server_name="0.0.0.0", server_port=7860)
|
| 95 |
|