Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
from fastai.vision.all import
|
3 |
|
4 |
learn = load_learner('export.pkl')
|
5 |
labels = learn.dls.vocab
|
@@ -9,20 +9,13 @@ def predict(img):
|
|
9 |
pred, pred_idx, probs = learn.predict(img)
|
10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
|
12 |
-
title = "Breast cancer detection with Deep Transfer Learning(ResNet18)."
|
13 |
-
description = "Upload a breast X-ray image to detect potential issues."
|
14 |
-
article = "Web app built and managed by Addai Fosberg"
|
15 |
-
examples = ['img1.jpeg', 'img2.jpeg']
|
16 |
-
|
17 |
iface = gr.Interface(
|
18 |
fn=predict,
|
19 |
inputs=gr.Image(),
|
20 |
outputs=gr.Label(num_top_classes=3),
|
21 |
-
title=
|
22 |
-
description=
|
23 |
-
|
24 |
-
examples=examples,
|
25 |
-
enable_queue=True
|
26 |
)
|
27 |
|
28 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import load_learner, PILImage
|
3 |
|
4 |
learn = load_learner('export.pkl')
|
5 |
labels = learn.dls.vocab
|
|
|
9 |
pred, pred_idx, probs = learn.predict(img)
|
10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
iface = gr.Interface(
|
13 |
fn=predict,
|
14 |
inputs=gr.Image(),
|
15 |
outputs=gr.Label(num_top_classes=3),
|
16 |
+
title="Breast Cancer Detection",
|
17 |
+
description="Upload a breast X-ray image to detect potential issues.",
|
18 |
+
examples=['img1.jpeg', 'img2.jpeg']
|
|
|
|
|
19 |
)
|
20 |
|
21 |
iface.launch()
|