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