Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ image_model = timm.create_model('resnet50', pretrained=True)
|
|
14 |
image_model.eval()
|
15 |
|
16 |
# Load saved TensorFlow eye disease detection model
|
17 |
-
eye_model = tf.keras.models.load_model('model.h5')
|
18 |
|
19 |
# Patient database
|
20 |
patients_db = []
|
@@ -214,7 +214,7 @@ def extract_pdf_report(pdf):
|
|
214 |
text += page.extract_text()
|
215 |
return text
|
216 |
|
217 |
-
def predict_eye_disease(input_image):
|
218 |
input_image = tf.image.resize(input_image, [224, 224]) / 255.0
|
219 |
input_image = tf.expand_dims(input_image, 0)
|
220 |
predictions = eye_model.predict(input_image)
|
@@ -223,7 +223,7 @@ def predict_eye_disease(input_image):
|
|
223 |
if confidence_scores['Normal'] > 50:
|
224 |
return f"Congrats! No disease detected. Confidence: {confidence_scores['Normal']}%"
|
225 |
return "\n".join([f"{label}: {confidence}%" for label, confidence in confidence_scores.items()])
|
226 |
-
|
227 |
def doctor_space(patient_id):
|
228 |
for patient in patients_db:
|
229 |
if patient["ID"] == patient_id:
|
@@ -287,12 +287,12 @@ report_analysis_interface = gr.Interface(
|
|
287 |
outputs="text",
|
288 |
)
|
289 |
|
290 |
-
eye_disease_interface = gr.Interface(
|
291 |
fn=predict_eye_disease,
|
292 |
inputs=gr.Image(label="Upload an Eye Image", type="numpy"),
|
293 |
outputs="text",
|
294 |
)
|
295 |
-
|
296 |
doctor_space_interface = gr.Interface(
|
297 |
fn=doctor_space,
|
298 |
inputs=gr.Number(label="Patient ID"),
|
@@ -333,9 +333,9 @@ with gr.Blocks() as app:
|
|
333 |
with gr.Tab("Extract PDF Report"):
|
334 |
pdf_extraction_interface.render()
|
335 |
|
336 |
-
with gr.Tab("Ophthalmologist Space"):
|
337 |
eye_disease_interface.render()
|
338 |
-
|
339 |
with gr.Tab("Doctor Space"):
|
340 |
doctor_space_interface.render()
|
341 |
|
|
|
14 |
image_model.eval()
|
15 |
|
16 |
# Load saved TensorFlow eye disease detection model
|
17 |
+
#eye_model = tf.keras.models.load_model('model.h5')
|
18 |
|
19 |
# Patient database
|
20 |
patients_db = []
|
|
|
214 |
text += page.extract_text()
|
215 |
return text
|
216 |
|
217 |
+
'''def predict_eye_disease(input_image):
|
218 |
input_image = tf.image.resize(input_image, [224, 224]) / 255.0
|
219 |
input_image = tf.expand_dims(input_image, 0)
|
220 |
predictions = eye_model.predict(input_image)
|
|
|
223 |
if confidence_scores['Normal'] > 50:
|
224 |
return f"Congrats! No disease detected. Confidence: {confidence_scores['Normal']}%"
|
225 |
return "\n".join([f"{label}: {confidence}%" for label, confidence in confidence_scores.items()])
|
226 |
+
'''
|
227 |
def doctor_space(patient_id):
|
228 |
for patient in patients_db:
|
229 |
if patient["ID"] == patient_id:
|
|
|
287 |
outputs="text",
|
288 |
)
|
289 |
|
290 |
+
'''eye_disease_interface = gr.Interface(
|
291 |
fn=predict_eye_disease,
|
292 |
inputs=gr.Image(label="Upload an Eye Image", type="numpy"),
|
293 |
outputs="text",
|
294 |
)
|
295 |
+
'''
|
296 |
doctor_space_interface = gr.Interface(
|
297 |
fn=doctor_space,
|
298 |
inputs=gr.Number(label="Patient ID"),
|
|
|
333 |
with gr.Tab("Extract PDF Report"):
|
334 |
pdf_extraction_interface.render()
|
335 |
|
336 |
+
''' with gr.Tab("Ophthalmologist Space"):
|
337 |
eye_disease_interface.render()
|
338 |
+
'''
|
339 |
with gr.Tab("Doctor Space"):
|
340 |
doctor_space_interface.render()
|
341 |
|