Spaces:
Sleeping
Sleeping
Commit ·
2ae819b
1
Parent(s): 5e0178d
init
Browse files- .ipynb_checkpoints/app-checkpoint.ipynb +0 -0
- .ipynb_checkpoints/pet-classifier-train-checkpoint.ipynb +0 -0
- app.ipynb +0 -0
- app.py +28 -0
- basset.jpg +0 -0
- basset.jpg:Zone.Identifier +4 -0
- model.pkl +3 -0
- model.pkl:Zone.Identifier +3 -0
- pet-classifier-train.ipynb +0 -0
- pet-classifier-train.ipynb:Zone.Identifier +3 -0
.ipynb_checkpoints/app-checkpoint.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.ipynb_checkpoints/pet-classifier-train-checkpoint.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
| 2 |
+
|
| 3 |
+
# %% auto 0
|
| 4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
| 5 |
+
|
| 6 |
+
# %% app.ipynb 1
|
| 7 |
+
from fastai.vision.all import *
|
| 8 |
+
import gradio as gr
|
| 9 |
+
import timm
|
| 10 |
+
|
| 11 |
+
# %% app.ipynb 3
|
| 12 |
+
learn = load_learner('model.pkl')
|
| 13 |
+
|
| 14 |
+
# %% app.ipynb 5
|
| 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 |
+
# %% app.ipynb 7
|
| 22 |
+
image = gr.Image(height=192, width=192) # lecture material deprecated
|
| 23 |
+
label = gr.Label()
|
| 24 |
+
examples = ['basset.jpg']
|
| 25 |
+
|
| 26 |
+
# %% app.ipynb 8
|
| 27 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 28 |
+
intf.launch(inline=False)
|
basset.jpg
ADDED
|
basset.jpg:Zone.Identifier
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[ZoneTransfer]
|
| 2 |
+
ZoneId=3
|
| 3 |
+
ReferrerUrl=https://www.google.com/
|
| 4 |
+
HostUrl=https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT9h3St2X6aJPDhGpZp2CdkXh194SHX5p2Fjg&s
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a59047e862f35c7be01d6c038388b7d6757c02f4a099cf45ae8f8ef81120c6bf
|
| 3 |
+
size 114986310
|
model.pkl:Zone.Identifier
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[ZoneTransfer]
|
| 2 |
+
ZoneId=3
|
| 3 |
+
HostUrl=https://www.kaggle.com/
|
pet-classifier-train.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
pet-classifier-train.ipynb:Zone.Identifier
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[ZoneTransfer]
|
| 2 |
+
ZoneId=3
|
| 3 |
+
HostUrl=https://www.kaggle.com/
|