Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,16 @@ DepthwiseConv2D.from_config = classmethod(
|
|
| 23 |
|
| 24 |
# --- Constants ---
|
| 25 |
IMG_SIZE = (224, 224)
|
| 26 |
-
CLASS_NAMES = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
LIME_EXPLAINER = lime_image.LimeImageExplainer()
|
| 28 |
|
| 29 |
# --- Load Model ---
|
|
@@ -89,7 +98,7 @@ The model predicted <strong>Normal</strong> because everything looks healthy:<br
|
|
| 89 |
- π Disc and macula are well-defined<br>
|
| 90 |
<span style='color:green'>βοΈ This is a healthy eye.</span>""",
|
| 91 |
|
| 92 |
-
'
|
| 93 |
Signs of diabetic eye disease:<br>
|
| 94 |
- πΆ Tiny red spots or swelling<br>
|
| 95 |
- π©Έ Damaged blood vessels<br>
|
|
@@ -110,7 +119,7 @@ Blurry image due to lens clouding:<br>
|
|
| 110 |
- π Faded details in retina<br>
|
| 111 |
<span style='color:gray'>β οΈ Cataract suspected.</span>""",
|
| 112 |
|
| 113 |
-
'AMD': """π§ **<span style='color:red'>AMD</span>**<br>
|
| 114 |
Macula shows degeneration:<br>
|
| 115 |
- π΄ Yellow spots in center<br>
|
| 116 |
- π Age-related changes<br>
|
|
@@ -169,9 +178,6 @@ def show_lime(img, model, pred_idx, pred_label, all_probs):
|
|
| 169 |
st.markdown(explanation_text.get(pred_label, "No explanation available."), unsafe_allow_html=True)
|
| 170 |
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
# --- Streamlit UI ---
|
| 176 |
st.set_page_config(page_title="π Retina Classifier with LIME", layout="wide")
|
| 177 |
st.title("π Retina Disease Classifier with LIME + Confidence Chart")
|
|
|
|
| 23 |
|
| 24 |
# --- Constants ---
|
| 25 |
IMG_SIZE = (224, 224)
|
| 26 |
+
CLASS_NAMES = [
|
| 27 |
+
'Normal',
|
| 28 |
+
'Diabetic Retinopathy', # Changed from 'Diabetes'
|
| 29 |
+
'Glaucoma',
|
| 30 |
+
'Cataract',
|
| 31 |
+
'Age-related Macular Degeneration (AMD)', # Changed from 'AMD'
|
| 32 |
+
'Hypertension',
|
| 33 |
+
'Myopia',
|
| 34 |
+
'Others'
|
| 35 |
+
]
|
| 36 |
LIME_EXPLAINER = lime_image.LimeImageExplainer()
|
| 37 |
|
| 38 |
# --- Load Model ---
|
|
|
|
| 98 |
- π Disc and macula are well-defined<br>
|
| 99 |
<span style='color:green'>βοΈ This is a healthy eye.</span>""",
|
| 100 |
|
| 101 |
+
'Diabetic Retinopathy': """π **<span style='color:orange'>Diabetic Retinopathy</span>**<br>
|
| 102 |
Signs of diabetic eye disease:<br>
|
| 103 |
- πΆ Tiny red spots or swelling<br>
|
| 104 |
- π©Έ Damaged blood vessels<br>
|
|
|
|
| 119 |
- π Faded details in retina<br>
|
| 120 |
<span style='color:gray'>β οΈ Cataract suspected.</span>""",
|
| 121 |
|
| 122 |
+
'Age-related Macular Degeneration (AMD)': """π§ **<span style='color:red'>Age-related Macular Degeneration (AMD)</span>**<br>
|
| 123 |
Macula shows degeneration:<br>
|
| 124 |
- π΄ Yellow spots in center<br>
|
| 125 |
- π Age-related changes<br>
|
|
|
|
| 178 |
st.markdown(explanation_text.get(pred_label, "No explanation available."), unsafe_allow_html=True)
|
| 179 |
|
| 180 |
|
|
|
|
|
|
|
|
|
|
| 181 |
# --- Streamlit UI ---
|
| 182 |
st.set_page_config(page_title="π Retina Classifier with LIME", layout="wide")
|
| 183 |
st.title("π Retina Disease Classifier with LIME + Confidence Chart")
|