Headlesss commited on
Commit
2d0f49c
·
verified ·
1 Parent(s): a80d7d2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('export.pkl')
6
+
7
+ label = learn.dls.vocab
8
+ def predict(img):
9
+ img = PILImage.create(img)
10
+ pred,pred_idx,probs = learn.predicts(img)
11
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+ title = "Dog Breed Classifier"
14
+ description = "A dog breed classifier trained on 10 most popular breed."
15
+ examples = []
16
+ interpretation='default'
17
+ enable_queue=True
18
+
19
+ gr.Interface(fn=predict,
20
+ input=gr.inputs.Imsge(shape=(512, 512)),
21
+ output=gr.outputs.Label(num_top_classes=3),
22
+ title=title,
23
+ description=description,
24
+ examples=examples,
25
+ interpretation=interpretation,
26
+ enable_queue=enable_queue).launch()