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