Spaces:
Running
Running
Upload with huggingface_hub
Browse files- README.md +5 -6
- requirements.txt +1 -0
- run.py +33 -0
README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
colorFrom: indigo
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.6
|
8 |
-
app_file:
|
9 |
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
+
|
2 |
---
|
3 |
+
title: blocks_form_main
|
4 |
+
emoji: 🔥
|
5 |
colorFrom: indigo
|
6 |
+
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
sdk_version: 3.6
|
9 |
+
app_file: run.py
|
10 |
pinned: false
|
11 |
---
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
https://gradio-main-build.s3.amazonaws.com/c3bec6153737855510542e8154391f328ac72606/gradio-3.6-py3-none-any.whl
|
run.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
with gr.Blocks() as demo:
|
4 |
+
error_box = gr.Textbox(label="Error", visible=False)
|
5 |
+
|
6 |
+
name_box = gr.Textbox(label="Name")
|
7 |
+
age_box = gr.Number(label="Age")
|
8 |
+
symptoms_box = gr.CheckboxGroup(["Cough", "Fever", "Runny Nose"])
|
9 |
+
submit_btn = gr.Button("Submit")
|
10 |
+
|
11 |
+
with gr.Column(visible=False) as output_col:
|
12 |
+
diagnosis_box = gr.Textbox(label="Diagnosis")
|
13 |
+
patient_summary_box = gr.Textbox(label="Patient Summary")
|
14 |
+
|
15 |
+
def submit(name, age, symptoms):
|
16 |
+
if len(name) == 0:
|
17 |
+
return {error_box: gr.update(value="Enter name", visible=True)}
|
18 |
+
if age < 0 or age > 200:
|
19 |
+
return {error_box: gr.update(value="Enter valid age", visible=True)}
|
20 |
+
return {
|
21 |
+
output_col: gr.update(visible=True),
|
22 |
+
diagnosis_box: "covid" if "Cough" in symptoms else "flu",
|
23 |
+
patient_summary_box: f"{name}, {age} y/o"
|
24 |
+
}
|
25 |
+
|
26 |
+
submit_btn.click(
|
27 |
+
submit,
|
28 |
+
[name_box, age_box, symptoms_box],
|
29 |
+
[error_box, diagnosis_box, patient_summary_box, output_col],
|
30 |
+
)
|
31 |
+
|
32 |
+
if __name__ == "__main__":
|
33 |
+
demo.launch()
|