stephen9686 commited on
Commit
75bced7
·
verified ·
1 Parent(s): 54fe0ab

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ learn = load_learner('model.pkl')
5
+
6
+ def classify_image(img):
7
+ pred, idx, probs = learn.predict(img)
8
+ return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
9
+
10
+ demo = gr.Interface(
11
+ fn=classify_image,
12
+ inputs=gr.Image(),
13
+ outputs=gr.Label()
14
+ )
15
+ demo.launch()