belsandre commited on
Commit
9308df3
1 Parent(s): 53f1abe

git add app.py

Browse files

git commit -m "Add model.pkl"
git push

Files changed (2) hide show
  1. app.py +9 -3
  2. model.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,13 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  iface.launch()
 
1
  import gradio as gr
2
 
3
+ learn = load_learner('export.pkl')
4
+
5
+ labels = learn.dls.vocab
6
+ def predict(img):
7
+ img = PILImage.create(img)
8
+ pred,pred_idx,probs = learn.predict(img)
9
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
10
+
11
+ iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
12
 
 
13
  iface.launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00e11deb6d8bd99df524b5b3dcde16c9b5459ef99b65382fa0f4a6e266e6ca50
3
+ size 47061355