Update app.py
Browse files
app.py
CHANGED
|
@@ -247,7 +247,7 @@ templates = {
|
|
| 247 |
# EXPLANATION BLOCK
|
| 248 |
# --------------------------------------------------
|
| 249 |
|
| 250 |
-
|
| 251 |
|
| 252 |
"medical": {
|
| 253 |
"pneumonia":
|
|
@@ -493,4 +493,12 @@ if uploaded_file:
|
|
| 493 |
caption = blip_processor.decode(caption_ids[0], skip_special_tokens=True)
|
| 494 |
|
| 495 |
st.subheader("Image Description (BLIP)")
|
| 496 |
-
st.write(caption)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
# EXPLANATION BLOCK
|
| 248 |
# --------------------------------------------------
|
| 249 |
|
| 250 |
+
EXPLANATIONS = {
|
| 251 |
|
| 252 |
"medical": {
|
| 253 |
"pneumonia":
|
|
|
|
| 493 |
caption = blip_processor.decode(caption_ids[0], skip_special_tokens=True)
|
| 494 |
|
| 495 |
st.subheader("Image Description (BLIP)")
|
| 496 |
+
st.write(caption)
|
| 497 |
+
|
| 498 |
+
explanation = EXPLANATIONS.get(predicted_class,"No explanation available.")
|
| 499 |
+
|
| 500 |
+
st.subheader("Detailed Explanation")
|
| 501 |
+
|
| 502 |
+
for line in explanation.strip().split("\n"):
|
| 503 |
+
if line.strip():
|
| 504 |
+
st.write(line.strip())
|