JeremyXie commited on
Commit
886cdbb
·
1 Parent(s): cb0b7ad

update app.py and model.pkl

Browse files
.ipynb_checkpoints/app-checkpoint.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
.ipynb_checkpoints/app-checkpoint.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).
2
+
3
+ __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
4
+
5
+ # Cell
6
+ from fastai.vision.all import *
7
+ import gradio as gr
8
+ import timm
9
+ from timm.models.layers import convert_splitbn_model, convert_sync_batchnorm, set_fast_norm
10
+
11
+ # Cell
12
+ learn = load_learner('model.pkl')
13
+
14
+ # Cell
15
+ categories = learn.dls.vocab
16
+
17
+ def classify_image(img):
18
+ pred,idx,probs = learn.predict(img)
19
+ return dict(zip(categories, map(float,probs)))
20
+
21
+ # Cell
22
+ image = gr.inputs.Image(shape=(192, 192))
23
+ label = gr.outputs.Label()
24
+ examples = ['basset.jpg']
25
+
26
+ # Cell
27
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
28
+ intf.launch()
.ipynb_checkpoints/requirements-checkpoint.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch <1.12
2
+ fastai>2.6.1
3
+ timm
.ipynb_checkpoints/train-checkpoint.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.ipynb CHANGED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -6,6 +6,7 @@ __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples'
6
  from fastai.vision.all import *
7
  import gradio as gr
8
  import timm
 
9
 
10
  # Cell
11
  learn = load_learner('model.pkl')
 
6
  from fastai.vision.all import *
7
  import gradio as gr
8
  import timm
9
+ from timm.models.layers import convert_splitbn_model, convert_sync_batchnorm, set_fast_norm
10
 
11
  # Cell
12
  learn = load_learner('model.pkl')
model.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:02eb3a56c6194f7249d17c6ce92fc59c068a0c35e0fc3d552402eae8c7a0f346
3
- size 114778679
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e410d4bd15a8591f3fbe19be76664942e27c5556bb604304539401746178c44e
3
+ size 114804961
train.ipynb CHANGED
The diff for this file is too large to render. See raw diff