danibalcells commited on
Commit
72d7955
1 Parent(s): 11b5886

Add app file

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ learn = load_learner('export.pkl')
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
+ gr.Interface(fn=predict, inputs=gr.components.Image(), outputs=gr.components.Label(num_top_classes=3)).launch(share=True)