Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def triage_decision(age, sex, chief_complaint, airway_breathing, pulse_rate_abnormal, bleeding, pain_response):
|
4 |
+
# Check if specific conditions are selected in the CheckboxGroup
|
5 |
+
respiratory_distress = "Cannot talk in complete sentences or obvious respiratory distress" in airway_breathing
|
6 |
+
cyanosis = "Central cyanosis" in airway_breathing
|
7 |
+
low_sp02 = "Sp02 <90%" in airway_breathing
|
8 |
+
|
9 |
+
if any([respiratory_distress, cyanosis, low_sp02, pulse_rate_abnormal, bleeding, pain_response]):
|
10 |
+
return '<div style="color: red" size=20>Send directly to Resuscitation area</div>'
|
11 |
+
else:
|
12 |
+
return '<div style="color: black">Regular processing</div>'
|
13 |
+
|
14 |
+
|
15 |
+
interface = gr.Interface(
|
16 |
+
fn=triage_decision,
|
17 |
+
inputs=[
|
18 |
+
gr.components.Number(label="Age"),
|
19 |
+
gr.components.Radio(choices=["Male", "Female", "Unknown"], label="Sex"),
|
20 |
+
gr.components.Textbox(label="Chief Complaint"),
|
21 |
+
gr.components.CheckboxGroup(
|
22 |
+
choices=[
|
23 |
+
"Cannot talk in complete sentences or obvious respiratory distress",
|
24 |
+
"Central cyanosis",
|
25 |
+
"Sp02 <90%"
|
26 |
+
],
|
27 |
+
label="Airway/Breathing"
|
28 |
+
),
|
29 |
+
gr.components.CheckboxGroup(
|
30 |
+
choices=[
|
31 |
+
"Pulse Rate <40 or >140 [adult] || <60 or >160 [Peds]",
|
32 |
+
"Rapid Uncontrolled Bleeding",
|
33 |
+
"Responds only to pain or unresponsive"
|
34 |
+
],
|
35 |
+
label="Circulation"
|
36 |
+
),
|
37 |
+
gr.components.CheckboxGroup(
|
38 |
+
choices=[
|
39 |
+
"Responds only to pain or unresponsive"
|
40 |
+
],
|
41 |
+
label="Disability"
|
42 |
+
),
|
43 |
+
|
44 |
+
],
|
45 |
+
outputs=gr.components.HTML(label="Decision"),
|
46 |
+
live=True,
|
47 |
+
title="Emergency Triage App",
|
48 |
+
description="Guides user through proper Triaging"
|
49 |
+
)
|
50 |
+
|
51 |
+
interface.launch()
|