Bytte's picture
chore: share space
fa8c886
raw
history blame contribute delete
785 Bytes
import gradio as gr
from fastai.vision.all import *
learner = load_learner('dermatologist_fastai.pkl')
categories = (
'acne_vulgaris',
'actinic_keratosis',
'allergic_contact_dermatitis',
'dermatofibroma',
'drug_induced_pigmentary_changes',
'granuloma_annulare',
'hidradenitis',
'kaposi_sarcoma',
'melanoma',
'necrobiosis_lipoidica',
'nematode_infection',
'neutrophilic_dermatoses',
'photodermatoses',
'psoriasis',
'sarcoidosis',
'xeroderma_pigmentosum'
)
def predict(img):
preds, idx, probs = learner.predict(img)
return dict(zip(categories, map(float, probs)))
def greet(name):
return "Hello " + name + "!!"
image = gr.Image()
label = gr.Label()
demo = gr.Interface(fn=predict, inputs=image, outputs=label)
demo.launch(inline=False, share=True)