Spaces:
Running
Running
Commit
·
724f7c8
1
Parent(s):
f3ff8bf
Upload folder using huggingface_hub
Browse files- requirements.txt +1 -1
- run.ipynb +1 -1
- run.py +2 -2
requirements.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
https://gradio-builds.s3.amazonaws.com/
|
|
|
1 |
+
https://gradio-builds.s3.amazonaws.com/da05e59a53bbad15e5755a47f46685da18e1031e/gradio-3.44.4-py3-none-any.whl
|
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_form"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "with gr.Blocks() as demo:\n", " error_box = gr.Textbox(label=\"Error\", visible=False)\n", "\n", " name_box = gr.Textbox(label=\"Name\")\n", " age_box = gr.Number(label=\"Age\", minimum=0, maximum=100)\n", " symptoms_box = gr.CheckboxGroup([\"Cough\", \"Fever\", \"Runny Nose\"])\n", " submit_btn = gr.Button(\"Submit\")\n", "\n", " with gr.Column(visible=False) as output_col:\n", " diagnosis_box = gr.Textbox(label=\"Diagnosis\")\n", " patient_summary_box = gr.Textbox(label=\"Patient Summary\")\n", "\n", " def submit(name, age, symptoms):\n", " if len(name) == 0:\n", " return {error_box: gr.
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_form"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "with gr.Blocks() as demo:\n", " error_box = gr.Textbox(label=\"Error\", visible=False)\n", "\n", " name_box = gr.Textbox(label=\"Name\")\n", " age_box = gr.Number(label=\"Age\", minimum=0, maximum=100)\n", " symptoms_box = gr.CheckboxGroup([\"Cough\", \"Fever\", \"Runny Nose\"])\n", " submit_btn = gr.Button(\"Submit\")\n", "\n", " with gr.Column(visible=False) as output_col:\n", " diagnosis_box = gr.Textbox(label=\"Diagnosis\")\n", " patient_summary_box = gr.Textbox(label=\"Patient Summary\")\n", "\n", " def submit(name, age, symptoms):\n", " if len(name) == 0:\n", " return {error_box: gr.Textbox(value=\"Enter name\", visible=True)}\n", " return {\n", " output_col: gr.Column(visible=True),\n", " diagnosis_box: \"covid\" if \"Cough\" in symptoms else \"flu\",\n", " patient_summary_box: f\"{name}, {age} y/o\",\n", " }\n", "\n", " submit_btn.click(\n", " submit,\n", " [name_box, age_box, symptoms_box],\n", " [error_box, diagnosis_box, patient_summary_box, output_col],\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -14,9 +14,9 @@ with gr.Blocks() as demo:
|
|
14 |
|
15 |
def submit(name, age, symptoms):
|
16 |
if len(name) == 0:
|
17 |
-
return {error_box: gr.
|
18 |
return {
|
19 |
-
output_col: gr.
|
20 |
diagnosis_box: "covid" if "Cough" in symptoms else "flu",
|
21 |
patient_summary_box: f"{name}, {age} y/o",
|
22 |
}
|
|
|
14 |
|
15 |
def submit(name, age, symptoms):
|
16 |
if len(name) == 0:
|
17 |
+
return {error_box: gr.Textbox(value="Enter name", visible=True)}
|
18 |
return {
|
19 |
+
output_col: gr.Column(visible=True),
|
20 |
diagnosis_box: "covid" if "Cough" in symptoms else "flu",
|
21 |
patient_summary_box: f"{name}, {age} y/o",
|
22 |
}
|