slf188 commited on
Commit
12924c2
1 Parent(s): a3336e4

Upload 4 files

Browse files
Files changed (4) hide show
  1. app.py +20 -0
  2. model.pkl +3 -0
  3. perros-gatos.ipynb +0 -0
  4. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ def is_cat(x):
5
+ return x[0].isupper()
6
+
7
+ learn = load_learner('model.pkl')
8
+
9
+ categories = ('Cat', 'Dog')
10
+
11
+ def classify_image(img):
12
+ pred, idx, probs = learn.predict(img)
13
+ return dict(zip(categories, map(float, probs)))
14
+
15
+ image = gr.inputs.Image(shape=(192,192))
16
+ label = gr.outputs.Label()
17
+ # examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
18
+
19
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label) # ,examples = examples)
20
+ intf.launch(inline=False)
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:335a91b193ab31e25a54cde80fc7b4836423d042050859d8129233c5e2f0189a
3
+ size 46958699
perros-gatos.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai