aliabd HF staff commited on
Commit
8b012a5
1 Parent(s): cd44512

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. requirements.txt +1 -1
  3. run.ipynb +1 -1
  4. run.py +3 -5
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
- sdk_version: 3.33.1
9
  app_file: run.py
10
  pinned: false
11
  ---
 
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 3.34.0
9
  app_file: run.py
10
  pinned: false
11
  ---
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
 
2
- https://gradio-main-build.s3.amazonaws.com/2829507e7d7b9be2887a3102d7b922cbb5d02562/gradio-3.33.1-py3-none-any.whl
 
1
 
2
+ https://gradio-main-build.s3.amazonaws.com/79e98dead54a86d7951936de5c0b4b663533b81a/gradio-3.34.0-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\")\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.update(value=\"Enter name\", visible=True)}\n", " if age < 0 or age > 200:\n", " return {error_box: gr.update(value=\"Enter valid age\", visible=True)}\n", " return {\n", " output_col: gr.update(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()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
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.update(value=\"Enter name\", visible=True)}\n", " return {\n", " output_col: gr.update(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
@@ -4,7 +4,7 @@ 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
 
@@ -15,12 +15,10 @@ with gr.Blocks() as demo:
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(
@@ -30,4 +28,4 @@ with gr.Blocks() as demo:
30
  )
31
 
32
  if __name__ == "__main__":
33
- demo.launch()
 
4
  error_box = gr.Textbox(label="Error", visible=False)
5
 
6
  name_box = gr.Textbox(label="Name")
7
+ age_box = gr.Number(label="Age", minimum=0, maximum=100)
8
  symptoms_box = gr.CheckboxGroup(["Cough", "Fever", "Runny Nose"])
9
  submit_btn = gr.Button("Submit")
10
 
 
15
  def submit(name, age, symptoms):
16
  if len(name) == 0:
17
  return {error_box: gr.update(value="Enter name", visible=True)}
 
 
18
  return {
19
  output_col: gr.update(visible=True),
20
  diagnosis_box: "covid" if "Cough" in symptoms else "flu",
21
+ patient_summary_box: f"{name}, {age} y/o",
22
  }
23
 
24
  submit_btn.click(
 
28
  )
29
 
30
  if __name__ == "__main__":
31
+ demo.launch()