sotoblanco commited on
Commit
de422e1
·
verified ·
1 Parent(s): 60158f7

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +26 -0
  2. dog.png +0 -0
  3. model.pkl +3 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #!export
3
+ from fastai.vision.all import *
4
+ import gradio as gr
5
+
6
+ def is_cat(x): return x[0].isupper()
7
+
8
+ #!export
9
+ learn = load_learner('model.pkl')
10
+
11
+ #!export
12
+ categories = ('Dog', 'Cat')
13
+
14
+ def classify_images(img):
15
+ pred, idx, probs = learn.predict(img)
16
+ return dict(zip(categories, map(float, probs)))
17
+
18
+ #!export
19
+ image = gr.Image(inputs=(192, 192))
20
+ label = gr.Label()
21
+ examples = ['dog.png']
22
+ intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)
23
+ intf.launch(inline=False)
24
+
25
+
26
+
dog.png ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70f33497161131e9bf60c90b8eddc1ae80a4289d09ea2b9173efdf415100e5da
3
+ size 47060011