Spaces:
Runtime error
Runtime error
# import gradio as gr | |
# def greet(name): | |
# return "Hello " + name + "!!" | |
# iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
# iface.launch() | |
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() | |
examples=['disease2.jpg','disease3.jpg','disease3.jpg'] | |
intf=gr.Interface(fn=classify_img,inputs=image,outputs=label,examples=examples) | |
intf.launch(inline=False) |