Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def diagnose_patient(age, sex, temperature, blood_pressure, heart_rate):
|
| 4 |
+
if age < 18:
|
| 5 |
+
return "Sorry, we do not provide diagnosis for minors."
|
| 6 |
+
elif sex == 'female' and age > 60 and temperature > 99:
|
| 7 |
+
return "Recommendation: Please see a doctor immediately."
|
| 8 |
+
elif blood_pressure > 140 or heart_rate < 60 or heart_rate > 100:
|
| 9 |
+
return "Recommendation: Please see a doctor at your earliest convenience."
|
| 10 |
+
else:
|
| 11 |
+
return "No diagnosis required at this time."
|
| 12 |
+
|
| 13 |
+
age_input = gr.inputs.Number(label="Age")
|
| 14 |
+
sex_input = gr.inputs.Radio(["male", "female"], label="Sex")
|
| 15 |
+
temperature_input = gr.inputs.Number(label="Temperature (in Fahrenheit)")
|
| 16 |
+
blood_pressure_input = gr.inputs.Number(label="Blood Pressure (systolic)")
|
| 17 |
+
heart_rate_input = gr.inputs.Number(label="Heart Rate")
|
| 18 |
+
|
| 19 |
+
gr.Interface(fn=diagnose_patient, inputs=[age_input, sex_input, temperature_input, blood_pressure_input, heart_rate_input], outputs="text").launch()
|