Files changed (1) hide show
  1. app.py +10 -0
app.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ learn = load_learner('model.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)