Addai commited on
Commit
faa52ed
·
1 Parent(s): 39636c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -9,8 +9,19 @@ def predict(img):
9
  img = PILImage.create(img)
10
  pred,pred_idx,probs = learn.predict(img)
11
  prediction = str(pred)
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- return prediction
14
 
15
 
16
 
 
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
+ return prediction, explanation
25
 
26
 
27