Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,23 @@ labels = learn.dls.vocab
|
|
8 |
def predict(img):
|
9 |
img = PILImage.create(img)
|
10 |
pred,pred_idx,probs = learn.predict(img)
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
title = "Breast cancer detection with AI(Deep Transfer Learning)"
|
14 |
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>"
|
|
|
8 |
def predict(img):
|
9 |
img = PILImage.create(img)
|
10 |
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
prediction = str(pred)
|
12 |
+
|
13 |
+
# Provide explanation based on the prediction
|
14 |
+
if pred == "cancer_positive":
|
15 |
+
explanation = "The model predicts that the image shows signs of cancer."
|
16 |
+
else:
|
17 |
+
explanation = "The model predicts that the image does not show signs of cancer."
|
18 |
+
|
19 |
+
return prediction, explanation
|
20 |
+
|
21 |
+
# Create the Gradio interface
|
22 |
+
inputs = gr.inputs.Image(label="Upload an image")
|
23 |
+
outputs = [
|
24 |
+
gr.outputs.Textbox(label="Prediction"),
|
25 |
+
gr.outputs.Textbox(label="Explanation")
|
26 |
+
]
|
27 |
+
|
28 |
|
29 |
title = "Breast cancer detection with AI(Deep Transfer Learning)"
|
30 |
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>"
|