Addai commited on
Commit
f93c48b
·
1 Parent(s): 6f4ba72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -21
app.py CHANGED
@@ -10,32 +10,12 @@ def predict(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
- elif pred == "Cancer_negative":
17
- explanation = "The model predicts that the image does not show signs of cancer."
18
- elif pred == "implant_cancer_positive":
19
- explanation = "The model predicts that the image shows signs of implant-related cancer."
20
- elif pred == "implant_cancer_negative":
21
- explanation = "The model predicts that the image does not show signs of implant-related cancer."
22
- else:
23
- explanation = "Unknown prediction."
24
-
25
- return prediction, explanation
26
-
27
- # Create the Gradio interface
28
- inputs = gr.inputs.Image(label="Upload an image")
29
- outputs = [
30
- gr.outputs.Textbox(label="Prediction"),
31
- gr.outputs.Textbox(label="Explanation")
32
- ]
33
-
34
 
35
  title = "Breast cancer detection with AI(Deep Transfer Learning)"
36
  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>"
37
  article="<p style='text-align: center'>Web app is built and managed by Addai Fosberg<b></p>"
38
  examples = ['img1.jpeg', 'img2.jpeg']
39
  enable_queue=True
 
40
 
41
  gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,enable_queue=enable_queue).launch()
 
10
  pred,pred_idx,probs = learn.predict(img)
11
  prediction = str(pred)
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  title = "Breast cancer detection with AI(Deep Transfer Learning)"
15
  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>"
16
  article="<p style='text-align: center'>Web app is built and managed by Addai Fosberg<b></p>"
17
  examples = ['img1.jpeg', 'img2.jpeg']
18
  enable_queue=True
19
+ #interpretation='default'
20
 
21
  gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,enable_queue=enable_queue).launch()