Spaces:
Running
Running
File size: 918 Bytes
3196562 8b012a5 3196562 7846c5d 724f7c8 3196562 8b012a5 3196562 7846c5d 3196562 8b012a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
with gr.Blocks() as demo:
name_box = gr.Textbox(label="Name")
age_box = gr.Number(label="Age", minimum=0, maximum=100)
symptoms_box = gr.CheckboxGroup(["Cough", "Fever", "Runny Nose"])
submit_btn = gr.Button("Submit")
with gr.Column(visible=False) as output_col:
diagnosis_box = gr.Textbox(label="Diagnosis")
patient_summary_box = gr.Textbox(label="Patient Summary")
def submit(name, age, symptoms):
return {
submit_btn: gr.Button(visible=False),
output_col: gr.Column(visible=True),
diagnosis_box: "covid" if "Cough" in symptoms else "flu",
patient_summary_box: f"{name}, {age} y/o",
}
submit_btn.click(
submit,
[name_box, age_box, symptoms_box],
[submit_btn, diagnosis_box, patient_summary_box, output_col],
)
if __name__ == "__main__":
demo.launch()
|