David Hrachovy commited on
Commit
fe546c0
1 Parent(s): e3f82b6
Files changed (3) hide show
  1. app.py +12 -0
  2. export.pkl +3 -0
  3. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('../input/first-gradio-birds/export.pkl')
5
+
6
+ labels = learn.dls.vocab
7
+ def predict(img):
8
+ img = PILImage.create(img)
9
+ pred,pred_idx,probs = learn.predict(img)
10
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
11
+
12
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)),examples=["bird.jpg"],outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f27c4ad0ad1af939ebb4fb8c77c8db3bf344a276f53d8c2747532d631bfed971
3
+ size 46957675
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai