Spaces:
Sleeping
Sleeping
Commit
·
93de706
1
Parent(s):
9bd43f7
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,27 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
|
5 |
+
learn = load_learner('final_resnet34_derma_model.pkl')
|
|
|
6 |
|
7 |
+
labels = learn.dls.vocab
|
8 |
+
|
9 |
+
def predict(img):
|
10 |
+
img = PILImage.create(img)
|
11 |
+
pred, pred_idx, probs = learn.predict(img)
|
12 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
13 |
+
|
14 |
+
image = gr.inputs.Image(shape=(400, 400))
|
15 |
+
label = gr.outputs.Label()
|
16 |
+
examples = ['nevus.jpg', 'keratosis.jpg', 'melanoma.jpg']
|
17 |
+
|
18 |
+
title = "DermaDoc Skin Lesion Analyzer!"
|
19 |
+
description = """This is a simple demo of how deep learning models \
|
20 |
+
can be trained for medical applications. \
|
21 |
+
The model distinguishes between two benign skin lesions (nevus and keratosis) \
|
22 |
+
and a malignant one (melanoma). It has an accuracy of 81 %"""
|
23 |
+
interpretation='default'
|
24 |
+
enable_queue=True
|
25 |
+
|
26 |
+
iface = gr.Interface(fn=predict, inputs=image, outputs=label,title=title, description=description, article=article, examples=examples, interpretation=interpretation, enable_queue=enable_queue)
|
27 |
iface.launch()
|