Pavan767 commited on
Commit
444e7ce
·
1 Parent(s): 400e657

deploying cats and dogs

Browse files
Files changed (3) hide show
  1. app.py +44 -5
  2. dog.jpg +0 -0
  3. model.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,46 @@
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
+ # -*- coding: utf-8 -*-
2
+ """dogs_cats.ipynb
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1M-mzhZdFQ2XWBSbLCuKzrmLsm0aLEYxQ
8
+
9
+ ## Gradio Pets
10
+ """
11
+
12
+
13
+
14
+ #|export
15
+ from fastai.vision.all import *
16
+
17
+ def is_cat(x): return x[0].isupper()
18
+
19
+
20
+
21
+ #|export
22
+ learn = load_learner('cat_dog.pkl')
23
+
24
+ #|export
25
+ categories = ('Dog','Cat')
26
+ def classify_image(img):
27
+ pred,idx,probs=learn.predict(img)
28
+ return dict(zip(categories,map(float,probs)))
29
+
30
+
31
+
32
+
33
+
34
+ #|export
35
+
36
+ import gradio
37
+ image = gradio.Image(type='pil')
38
+ label = gradio.Label()
39
+
40
+ examples = ['dog.jpeg','cat.jpeg']
41
+ intf = gradio.Interface(fn=classify_image,inputs=image,outputs=label,examples=examples)
42
+ intf.launch(inline=False)
43
+
44
+
45
 
 
 
46
 
 
 
dog.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:036e01abcf091bb1ca180ae913d2d5d6555f1e436960b428a40746c3419d41f4
3
+ size 46966993