Eschatologist commited on
Commit
538fcf2
·
1 Parent(s): 83e84bf

let's deploy to huggingface spaces

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. app.py +19 -0
  3. cat.jpg +0 -0
  4. dog.jpg +0 -0
  5. dunno.jpg +0 -0
  6. model.pkl +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model.pkl filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ def is_cat(x): return x[0].isupper()
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
+ examples = ['dog.jpg','cat.jpg','dunno.jpg']
17
+
18
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
19
+ intf.launch(inline=False)
cat.jpg ADDED
dog.jpg ADDED
dunno.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9f02e2ae921a974ed7e2bda041ccde58eb852dc279c5efc9d5a14ca66583540
3
+ size 47061265