Spaces:
Runtime error
Runtime error
File size: 1,379 Bytes
ad8be4c 795a8b3 ad8be4c 795a8b3 ad8be4c 795a8b3 ad8be4c |
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 |
# 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) |