Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -80,7 +80,7 @@ def predict_eye_disease(input_image):
|
|
80 |
def doctor_space(patient_id):
|
81 |
for patient in patients_db:
|
82 |
if patient["ID"] == patient_id:
|
83 |
-
return f"
|
84 |
return "β Patient not found. Please check the ID."
|
85 |
|
86 |
def pharmacist_space(patient_id):
|
@@ -95,8 +95,8 @@ def patient_dashboard(patient_id, password):
|
|
95 |
return (f"π©Ί Name: {patient['Name']}\n"
|
96 |
f"π Diagnosis: {patient['Diagnosis']}\n"
|
97 |
f"π Medications: {patient['Medications']}\n"
|
98 |
-
f"
|
99 |
-
f"
|
100 |
return "β Access Denied: Invalid ID or Password."
|
101 |
|
102 |
def doctor_dashboard(password):
|
@@ -109,25 +109,68 @@ def doctor_dashboard(password):
|
|
109 |
details.append(f"π©Ί Name: {patient['Name']}\n"
|
110 |
f"π Diagnosis: {patient['Diagnosis']}\n"
|
111 |
f"π Medications: {patient['Medications']}\n"
|
112 |
-
f"
|
113 |
-
f"
|
114 |
return "\n\n".join(details)
|
115 |
|
116 |
-
#
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
inputs=gr.Textbox(label="Ask the Doctor (Consultation Query)", placeholder="Enter your medical query here..."),
|
128 |
outputs="text",
|
129 |
-
title="Doctor Consultant",
|
130 |
-
description="Get expert advice from the Doctor Consultant powered by AI. Ask any medical-related questions and get responses."
|
131 |
)
|
132 |
|
133 |
# Gradio App Layout
|
@@ -157,8 +200,5 @@ with gr.Blocks() as app:
|
|
157 |
|
158 |
with gr.Tab("Doctor Dashboard"):
|
159 |
doctor_dashboard_interface.render()
|
160 |
-
|
161 |
-
with gr.Tab("Doctor Consultant"):
|
162 |
-
doctor_consultation_interface.render()
|
163 |
|
164 |
-
app.launch(share=True)
|
|
|
80 |
def doctor_space(patient_id):
|
81 |
for patient in patients_db:
|
82 |
if patient["ID"] == patient_id:
|
83 |
+
return f"β Precautions: {patient['Precautions']}\nπ©ββ Recommended Doctor: {patient['Doctor']}"
|
84 |
return "β Patient not found. Please check the ID."
|
85 |
|
86 |
def pharmacist_space(patient_id):
|
|
|
95 |
return (f"π©Ί Name: {patient['Name']}\n"
|
96 |
f"π Diagnosis: {patient['Diagnosis']}\n"
|
97 |
f"π Medications: {patient['Medications']}\n"
|
98 |
+
f"β Precautions: {patient['Precautions']}\n"
|
99 |
+
f"π©ββ Recommended Doctor: {patient['Doctor']}")
|
100 |
return "β Access Denied: Invalid ID or Password."
|
101 |
|
102 |
def doctor_dashboard(password):
|
|
|
109 |
details.append(f"π©Ί Name: {patient['Name']}\n"
|
110 |
f"π Diagnosis: {patient['Diagnosis']}\n"
|
111 |
f"π Medications: {patient['Medications']}\n"
|
112 |
+
f"β Precautions: {patient['Precautions']}\n"
|
113 |
+
f"π©ββ Recommended Doctor: {patient['Doctor']}")
|
114 |
return "\n\n".join(details)
|
115 |
|
116 |
+
# Gradio Interfaces
|
117 |
+
registration_interface = gr.Interface(
|
118 |
+
fn=register_patient,
|
119 |
+
inputs=[
|
120 |
+
gr.Textbox(label="Patient Name"),
|
121 |
+
gr.Number(label="Age"),
|
122 |
+
gr.Radio(label="Gender", choices=["Male", "Female", "Other"]),
|
123 |
+
gr.Textbox(label="Set Password", type="password"),
|
124 |
+
],
|
125 |
+
outputs="text",
|
126 |
+
)
|
127 |
+
|
128 |
+
pdf_extraction_interface = gr.Interface(
|
129 |
+
fn=extract_pdf_report,
|
130 |
+
inputs=gr.File(label="Upload PDF Report"),
|
131 |
+
outputs="text",
|
132 |
+
)
|
133 |
+
|
134 |
+
report_analysis_interface = gr.Interface(
|
135 |
+
fn=analyze_report,
|
136 |
+
inputs=[
|
137 |
+
gr.Number(label="Patient ID"),
|
138 |
+
gr.Textbox(label="Report Text"),
|
139 |
+
],
|
140 |
+
outputs="text",
|
141 |
+
)
|
142 |
+
|
143 |
+
eye_disease_interface = gr.Interface(
|
144 |
+
fn=predict_eye_disease,
|
145 |
+
inputs=gr.Image(label="Upload an Eye Image", type="numpy"),
|
146 |
+
outputs="text",
|
147 |
+
)
|
148 |
+
|
149 |
+
doctor_space_interface = gr.Interface(
|
150 |
+
fn=doctor_space,
|
151 |
+
inputs=gr.Number(label="Patient ID"),
|
152 |
+
outputs="text",
|
153 |
+
)
|
154 |
+
|
155 |
+
pharmacist_space_interface = gr.Interface(
|
156 |
+
fn=pharmacist_space,
|
157 |
+
inputs=gr.Number(label="Patient ID"),
|
158 |
+
outputs="text",
|
159 |
+
)
|
160 |
|
161 |
+
patient_dashboard_interface = gr.Interface(
|
162 |
+
fn=patient_dashboard,
|
163 |
+
inputs=[
|
164 |
+
gr.Number(label="Patient ID"),
|
165 |
+
gr.Textbox(label="Password", type="password"),
|
166 |
+
],
|
167 |
+
outputs="text",
|
168 |
+
)
|
169 |
|
170 |
+
doctor_dashboard_interface = gr.Interface(
|
171 |
+
fn=doctor_dashboard,
|
172 |
+
inputs=gr.Textbox(label="Doctor Password", type="password"),
|
|
|
173 |
outputs="text",
|
|
|
|
|
174 |
)
|
175 |
|
176 |
# Gradio App Layout
|
|
|
200 |
|
201 |
with gr.Tab("Doctor Dashboard"):
|
202 |
doctor_dashboard_interface.render()
|
|
|
|
|
|
|
203 |
|
204 |
+
app.launch(share=True)
|