Update app.py
Browse files
app.py
CHANGED
@@ -9,21 +9,18 @@ def predict(img):
|
|
9 |
img = PILImage.create(img)
|
10 |
pred,pred_idx,probs = learn.predict(img)
|
11 |
prediction = str(pred)
|
12 |
-
# Provide explanation based on the prediction
|
13 |
-
if pred == "cancer_positive":
|
14 |
-
explanation = "The model predicts that the image shows signs of cancer."
|
15 |
-
elif pred == "cancer_negative":
|
16 |
-
explanation = "The model predicts that the image does not show signs of cancer."
|
17 |
-
elif pred == "implant_cancer_positive":
|
18 |
-
explanation = "The model predicts that the image shows signs of implant-related cancer."
|
19 |
-
elif pred == "implant_cancer_negative":
|
20 |
-
explanation = "The model predicts that the image does not show signs of implant-related cancer."
|
21 |
-
else:
|
22 |
-
explanation = "Unknown prediction."
|
23 |
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
|
|
27 |
|
28 |
title = "Breast cancer detection with AI(Deep Transfer Learning)"
|
29 |
description = "<p style='text-align: center'><b>As a radiologist or oncologist, it is crucial to know what is wrong with a breast x-ray image.<b><br><b>Upload the breast X-ray image to know what is wrong with a patients breast with or without inplant<b><p>"
|
|
|
9 |
img = PILImage.create(img)
|
10 |
pred,pred_idx,probs = learn.predict(img)
|
11 |
prediction = str(pred)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
explanations = {
|
14 |
+
"cancer_negative": "The image does not show signs of cancer.",
|
15 |
+
"cancer_positive": "The image shows signs of cancer.",
|
16 |
+
"implant_cancer_positive": "The image shows signs of implant-related cancer.",
|
17 |
+
"implant_cancer_negative": "The image does not show signs of implant-related cancer."
|
18 |
+
}
|
19 |
+
|
20 |
+
# Get the explanation for the predicted class
|
21 |
+
explanation = explanations[prediction]
|
22 |
|
23 |
+
return prediction, explanation
|
24 |
|
25 |
title = "Breast cancer detection with AI(Deep Transfer Learning)"
|
26 |
description = "<p style='text-align: center'><b>As a radiologist or oncologist, it is crucial to know what is wrong with a breast x-ray image.<b><br><b>Upload the breast X-ray image to know what is wrong with a patients breast with or without inplant<b><p>"
|