Update app.py
Browse files
app.py
CHANGED
@@ -9,26 +9,9 @@ def predict(img):
|
|
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
|
24 |
-
|
25 |
|
26 |
-
# Create the Gradio interface
|
27 |
-
inputs = gr.inputs.Image(label="Upload a breast X-ray image")
|
28 |
-
outputs = [
|
29 |
-
gr.outputs.Textbox(label="Prediction"),
|
30 |
-
gr.outputs.Textbox(label="Explanation")
|
31 |
-
]
|
32 |
|
33 |
title = "Breast cancer detection with AI(Deep Transfer Learning)"
|
34 |
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 |
+
return prediction
|
|
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
title = "Breast cancer detection with AI(Deep Transfer Learning)"
|
17 |
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>"
|