jph00 commited on
Commit
6855de5
1 Parent(s): a9d743c
Files changed (3) hide show
  1. .gitattributes +2 -0
  2. app.py +14 -4
  3. model.pkl +3 -0
.gitattributes CHANGED
@@ -25,3 +25,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ *.pkl filter=lfs diff=lfs merge=lfs -text
29
+ *.jpg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,7 +1,17 @@
 
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
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+ l2 = load_learner('model.lrn')
5
+ categories = ('Dog', 'Cat')
6
+
7
+ def classify_image(img):
8
+ pred,idx,probs = l2.predict(img)
9
+ return dict(zip(categories, map(float,probs)))
10
+
11
+ image = gr.inputs.Image(shape=(128, 128))
12
+ label = gr.outputs.Label()
13
+ examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
14
+
15
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
16
+ intf.launch()
17
 
 
 
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:947bb9f530fa256cc4d96b9f1032193c4b329fe7a7794001cb56690a46255356
3
+ size 87551659