update app.py and model.pkl
Browse files- .ipynb_checkpoints/app-checkpoint.ipynb +0 -0
- .ipynb_checkpoints/app-checkpoint.py +28 -0
- .ipynb_checkpoints/requirements-checkpoint.txt +3 -0
- .ipynb_checkpoints/train-checkpoint.ipynb +0 -0
- app.ipynb +0 -0
- app.py +1 -0
- model.pkl +2 -2
- train.ipynb +0 -0
.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:
|
| 3 |
-
size
|
|
|
|
| 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
|
|
|