SkinDocAI / app.py
Astroboy01's picture
let's deploy to huggingface spaces
765b729
raw
history blame contribute delete
971 Bytes
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()