nimmicus commited on
Commit
3ed4f7b
·
verified ·
1 Parent(s): 8fe13dc

Upload 4 files

Browse files
Files changed (5) hide show
  1. .gitattributes +2 -0
  2. app.py +26 -4
  3. cat.jpg +3 -0
  4. dog.jpg +3 -0
  5. dunno.jpg +0 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ cat.jpg filter=lfs diff=lfs merge=lfs -text
37
+ dog.jpg filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -1,8 +1,30 @@
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
8
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
5
+
6
+ # %% app.ipynb 2
7
+ from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ def is_cat(x): return x[0].isupper()
11
+
12
+ # %% app.ipynb 4
13
+ learn = load_learner('model.pkl')
14
+
15
+ # %% app.ipynb 6
16
+ categories = ('Dog','Cat')
17
+
18
+ def classify_image(img):
19
+ pred, idx, probs = learn.predict(img)
20
+ return dict(zip(categories, map(float,probs)))
21
 
22
+ # %% app.ipynb 8
23
+ #image = gr.inputs.Image(shape=(192,192))
24
+ image = gr.Image(width=192, height=192)
25
+ #label = gr.outputs.Label()
26
+ label = gr.Label()
27
+ examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
28
 
29
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
30
+ intf.launch(inline=False)
cat.jpg ADDED

Git LFS Details

  • SHA256: 54e27052739947897a0075fcc47774a163fa618bfb7b83bf0570259780147a6f
  • Pointer size: 131 Bytes
  • Size of remote file: 112 kB
dog.jpg ADDED

Git LFS Details

  • SHA256: 9c9b8b5759af140e8c4bf6f3b3e6942331b6a0c07a9e4cf006c03a179fe2ca7b
  • Pointer size: 131 Bytes
  • Size of remote file: 299 kB
dunno.jpg ADDED