Spaces:
Build error
Build error
| import gradio as gr | |
| def triage_decision(age, sex, chief_complaint, airway_breathing, pulse_rate_abnormal, bleeding, pain_response): | |
| # Check if specific conditions are selected in the CheckboxGroup | |
| respiratory_distress = "Cannot talk in complete sentences or obvious respiratory distress" in airway_breathing | |
| cyanosis = "Central cyanosis" in airway_breathing | |
| low_sp02 = "Sp02 <90%" in airway_breathing | |
| if any([respiratory_distress, cyanosis, low_sp02, pulse_rate_abnormal, bleeding, pain_response]): | |
| return '<div style="color: red" size=20>Send directly to Resuscitation area</div>' | |
| else: | |
| return '<div style="color: black">Regular processing</div>' | |
| interface = gr.Interface( | |
| fn=triage_decision, | |
| inputs=[ | |
| gr.components.Number(label="Age"), | |
| gr.components.Radio(choices=["Male", "Female", "Unknown"], label="Sex"), | |
| gr.components.Textbox(label="Chief Complaint"), | |
| gr.components.CheckboxGroup( | |
| choices=[ | |
| "Cannot talk in complete sentences or obvious respiratory distress", | |
| "Central cyanosis", | |
| "Sp02 <90%" | |
| ], | |
| label="Airway/Breathing" | |
| ), | |
| gr.components.CheckboxGroup( | |
| choices=[ | |
| "Pulse Rate <40 or >140 [adult] || <60 or >160 [Peds]", | |
| "Rapid Uncontrolled Bleeding", | |
| "Responds only to pain or unresponsive" | |
| ], | |
| label="Circulation" | |
| ), | |
| gr.components.CheckboxGroup( | |
| choices=[ | |
| "Responds only to pain or unresponsive" | |
| ], | |
| label="Disability" | |
| ), | |
| ], | |
| outputs=gr.components.HTML(label="Decision"), | |
| live=True, | |
| title="Emergency Triage App", | |
| description="Guides user through proper Triaging" | |
| ) | |
| interface.launch() | |