Sefat33 commited on
Commit
982bb15
·
verified ·
1 Parent(s): 9567a73

Delete coatnet_retina_app/app.py

Browse files
Files changed (1) hide show
  1. coatnet_retina_app/app.py +0 -38
coatnet_retina_app/app.py DELETED
@@ -1,38 +0,0 @@
1
-
2
- import streamlit as st
3
- import tensorflow as tf
4
- import numpy as np
5
- from PIL import Image
6
- import os
7
-
8
- from utils.gradcam import generate_gradcam
9
- from utils.lime_explainer import explain_with_lime
10
- from preprocessing.preprocess import preprocess_image
11
-
12
- @st.cache_resource
13
- def load_model():
14
- return tf.keras.models.load_model("model.keras")
15
-
16
- model = load_model()
17
-
18
- class_names = ["Normal", "Diabetes", "Glaucoma", "Cataract", "AMD", "Hypertension", "Myopia", "Others"]
19
-
20
- st.title("🧠 Retinal Disease Classifier (CoAtNet)")
21
- uploaded_file = st.file_uploader("Upload a retinal image", type=["jpg", "png", "jpeg"])
22
-
23
- if uploaded_file:
24
- image = Image.open(uploaded_file).convert("RGB")
25
- st.image(image, caption="Input Image", use_column_width=True)
26
-
27
- img_array = preprocess_image(image)
28
- pred = model.predict(np.expand_dims(img_array, axis=0))
29
- predicted_class = class_names[np.argmax(pred)]
30
- st.success(f"✅ Predicted Disease: **{predicted_class}**")
31
-
32
- st.subheader("🔍 Grad-CAM Explanation")
33
- gradcam = generate_gradcam(model, img_array)
34
- st.image(gradcam, caption="Grad-CAM", use_column_width=True)
35
-
36
- st.subheader("🔍 LIME Explanation")
37
- lime_expl = explain_with_lime(model, img_array)
38
- st.image(lime_expl, caption="LIME Explanation", use_column_width=True)