neopolita commited on
Commit
853b0b0
1 Parent(s): f4cd9a8
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,8 +1,16 @@
1
  import gradio as gr
2
  from fastai.vision.all import *
3
 
4
- def greet(name):
5
- return "Hello " + name + "!!"
6
 
7
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
8
- iface.launch()
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from fastai.vision.all import *
3
 
4
+ learn = load_learner('export.pkl')
 
5
 
6
+ categories = ('grizzly', 'black', 'teddy')
7
+
8
+ def classify_image(img):
9
+ pred, idx, probs = learn.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
+
12
+ image = gr.inputs.Image(shape=(224, 224))
13
+ label = gr.outputs.Label()
14
+
15
+ iface = gr.Interface(fn=classify_image, inputs=image, outputs=label)
16
+ iface.launch(inline=False)