Kenno104 commited on
Commit
abbdc57
·
1 Parent(s): 943d7df
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -1,9 +1,10 @@
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()
 
 
 
8
 
9
- #Does this work?
 
 
1
+ learn = load_learner('export.pkl')
 
 
 
2
 
3
+ labels = learn.dls.vocab
4
+ def predict(img):
5
+ img = PILImage.create(img)
6
+ pred,pred_idx,probs = learn.predict(img)
7
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
8
 
9
+ import gradio as gr
10
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)