Spaces:
Runtime error

File size: 1,124 Bytes
febed37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f41f6ea
 
 
febed37
 
 
 
 
 
 
 
97697f1
d97b2a7
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
26
27
28
29
from fastai.vision.all import *
import skimage
import gradio as gr

def predict(img):
    pred,pred_idx,probs = learn.predict(img)
    return {labels[i]: float(probs[i]) for i in range(len(labels))}


learn = load_learner('export.pkl')
labels = learn.dls.vocab

title = "Demodex Blepharitis Classifier"
description = "A classifier trained on public images to detect Demodex Blepharitis. (Demo)"
# article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
interpretation = "default"
examples = ['examples/demodex/blepharitis.jpg',
            'examples/demodex/demodex.jpg',
            'examples/no_demodex/10485-coconut_oil_for_eyelashes_732x549-thumbnail-Recovered-732x549.jpg']

gr.Interface(fn=predict, 
             inputs=gr.inputs.Image(shape=(512, 512)), 
             outputs=gr.outputs.Label(num_top_classes=2),
             title = title,
             description = description,
            #  article=article,
             examples=examples,
             #interpretation=interpretation,
             ).launch(enable_queue=True)