siriously commited on
Commit
2176c8b
1 Parent(s): f0d2ca7

initial commit

Browse files
Files changed (6) hide show
  1. app.ipynb +0 -0
  2. app.py +27 -0
  3. cat.jpg +0 -0
  4. dog.jpg +0 -0
  5. dunno.jpg +0 -0
  6. firstModel.pkl +3 -0
app.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cal', 'is_cat', 'classify_image']
5
+
6
+ # %% ../app.ipynb 4
7
+ from fastai.vision.all import *
8
+ import gradio as gr
9
+ def is_cal(x): return x[0].isupper()
10
+
11
+ # %% ../app.ipynb 7
12
+ def is_cat(x): return x[0].isupper()
13
+ learn = load_learner('firstModel.pkl')
14
+
15
+ # %% ../app.ipynb 9
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 11
23
+ image = gr.components.Image(shape=(192,192))
24
+ label = gr.components.Label()
25
+ examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
26
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
27
+ intf.launch(inline=False)
cat.jpg ADDED
dog.jpg ADDED
dunno.jpg ADDED
firstModel.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a45fb681eeeb7edd0ca18239321391b3a406663026b08e8c307d3f83bccfbaf
3
+ size 47061419