Spaces:
Runtime error

Phani Srikanth commited on
Commit
febed37
·
1 Parent(s): 1e95de3
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import skimage
3
+ import gradio as gr
4
+
5
+ def predict(img):
6
+ pred,pred_idx,probs = learn.predict(img)
7
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
8
+
9
+
10
+ learn = load_learner('export.pkl')
11
+ labels = learn.dls.vocab
12
+
13
+ title = "Demodex Blepharitis Classifier"
14
+ description = "A classifier trained on public images to detect Demodex Blepharitis. (Demo)"
15
+ # article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
16
+ interpretation = "default"
17
+ examples = ['projectO/Experiments/phase0/demodex/blepharitis.jpg',
18
+ 'projectO/Experiments/phase0/demodex/demodex.jpg',
19
+ 'projectO/Experiments/phase0/no_demodex/10485-coconut_oil_for_eyelashes_732x549-thumbnail-Recovered-732x549.jpg']
20
+
21
+ gr.Interface(fn=predict,
22
+ inputs=gr.inputs.Image(shape=(512, 512)),
23
+ outputs=gr.outputs.Label(num_top_classes=2),
24
+ title = title,
25
+ description = description,
26
+ # article=article,
27
+ examples=examples,
28
+ interpretation=interpretation,
29
+ enable_queue=True).launch(share=True)