Caleb O'Leary commited on
Commit
e01ccbe
·
1 Parent(s): 1aa8944
Files changed (2) hide show
  1. app.py +23 -6
  2. model.pkl +3 -0
app.py CHANGED
@@ -1,10 +1,27 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!! " + reverse(name)
5
 
6
- def reverse(name):
7
- return name[::-1]
8
 
9
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
10
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
+ __all__ = ['is_cat', 'learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
 
5
 
6
+ learn = load_learner('model.pkl')
 
7
 
8
+ categories = ('Dog', "Cat")
9
+
10
+ def classify_image(img):
11
+ pred,idx,probs = learn.predict(img)
12
+ return dict(zip(categories, map(float, probs)))
13
+
14
+ image = gr.inputs.Image(shape=(192, 192))
15
+ label = gr.outputs.Label()
16
+
17
+ intf = gr.Interface(fn=classify_image, inputs=image outputs=label)
18
+ intf.launch(inline=False)
19
+
20
+ # def greet(name):
21
+ # return "Hello " + name + "!! " + reverse(name)
22
+
23
+ # def reverse(name):
24
+ # return name[::-1]
25
+
26
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
27
+ # iface.launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d8abe14790ebdac53f8a7244e8a8dbcfd25eb1faa464a9fd05ef0341e614028
3
+ size 47071979