Spaces:
Runtime error
Runtime error
File size: 1,145 Bytes
a7687e4 c41c03e a7687e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastai.vision.all import *
import gradio as gr
diseaseDict={'1':'Eczema','2':'Melanoma','3':'Atopic Dermatitis','4':'Basal Cell Carcinoma','5':'Melanocytic Nevi','6':'Benign Keratosis like Lesions','7':'Psoriasis pictures Lichen Planus and other related diseases','8':'Seborrheic Keratoses and other Benign Tumors','9':'Tinea Ringworm Candidiasis and other Fungal Infections','10':'Warts Molluscum and other Viral Infections'}
def label_func(x): return diseaseDict[x.parent.name[0]]
learn=load_learner('modelSkinDiseaseDetector.pkl')
categories = ('Eczema','Melanoma','Atopic Dermatitis','Basal Cell Carcinoma','Melanocytic Nevi','Benign Keratosis like Lesions','Psoriasis pictures Lichen Planus and other related diseases','Seborrheic Keratoses and other Benign Tumors','Tinea Ringworm Candidiasis and other Fungal Infections','Warts Molluscum and other Viral Infections')
def classify_img(img):
pred,idx,probs=learn.predict(img)
return dict(zip(categories,map(float,probs)))
image=gr.inputs.Image(shape=(192,192))
label=gr.outputs.Label()
intf=gr.Interface(fn=classify_img,inputs=image,outputs=label)
intf.launch(inline=False) |