jph00 commited on
Commit
39c77b4
·
1 Parent(s): 6459c4f

Fleshed out app

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -1,7 +1,23 @@
 
 
 
 
 
 
 
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()
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: exportmodel.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'intf', 'classify_image']
5
+
6
+ # %% exportmodel.ipynb 1
7
+ from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ # %% exportmodel.ipynb 3
11
+ learn = load_learner("bears.pkl")
12
+
13
+ # %% exportmodel.ipynb 5
14
+ categories = ('Black Bear', 'Grizzly Bear', 'Teddy Bear')
15
+ def classify_image(img):
16
+ pred, idx, probs = learn.predict(img)
17
+ return dict(zip(categories, map(float, probs)))
18
 
19
+ # %% exportmodel.ipynb 7
20
+ image = gr.Image(height=250, width=250)
21
+ label = gr.Label()
22
+ intf = gr.Interface(fn = classify_image, inputs = image, outputs = label)
23
+ intf.launch(inline = False, share = True)