n0no123's picture
Upload app.py
be2f388
import gradio as gr
def diagnose_patient(age, sex, temperature, blood_pressure, heart_rate):
if age < 18:
return "Sorry, we do not provide diagnosis for minors."
elif sex == 'female' and age > 60 and temperature > 99:
return "Recommendation: Please see a doctor immediately."
elif blood_pressure > 140 or heart_rate < 60 or heart_rate > 100:
return "Recommendation: Please see a doctor at your earliest convenience."
else:
return "No diagnosis required at this time."
age_input = gr.inputs.Number(label="Age")
sex_input = gr.inputs.Radio(["male", "female"], label="Sex")
temperature_input = gr.inputs.Number(label="Temperature (in Fahrenheit)")
blood_pressure_input = gr.inputs.Number(label="Blood Pressure (systolic)")
heart_rate_input = gr.inputs.Number(label="Heart Rate")
gr.Interface(fn=diagnose_patient, inputs=[age_input, sex_input, temperature_input, blood_pressure_input, heart_rate_input], outputs="text").launch()