Spaces:
Running
Running
Commit
·
a0db1e3
1
Parent(s):
960c6de
fix: Sample files missing
Browse files- .gitattributes +1 -0
- app.py +7 -7
- sample/.DS_Store +0 -0
- sample/cat.jpg +3 -0
- sample/dog.jpg +3 -0
- sample/dunno.jpg +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ 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 |
+
sample/*.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -1,24 +1,24 @@
|
|
| 1 |
-
# AUTOGENERATED! DO NOT EDIT! File to edit: dog-or-cat.ipynb.
|
| 2 |
|
| 3 |
# %% auto 0
|
| 4 |
__all__ = ['learner', 'categories', 'example_imgs_path', 'img', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
|
| 5 |
|
| 6 |
-
# %% dog-or-cat.ipynb 2
|
| 7 |
# Imports
|
| 8 |
from fastai.vision.all import PILImage
|
| 9 |
from fastai.vision.all import load_learner
|
| 10 |
from pathlib import Path
|
| 11 |
import gradio as gr
|
| 12 |
|
| 13 |
-
# %% dog-or-cat.ipynb 4
|
| 14 |
# Function to check if it is a cat
|
| 15 |
def is_cat(x): return x[0].isupper()
|
| 16 |
|
| 17 |
-
# %% dog-or-cat.ipynb 6
|
| 18 |
# Load the trained model
|
| 19 |
learner = load_learner(fname="./dog_or_cat.pkl")
|
| 20 |
|
| 21 |
-
# %% dog-or-cat.ipynb 8
|
| 22 |
categories = ("Cat", "Dog")
|
| 23 |
|
| 24 |
def classify_image(img):
|
|
@@ -26,8 +26,8 @@ def classify_image(img):
|
|
| 26 |
print(pred, idx)
|
| 27 |
return dict(zip(categories, map(float, probs)))
|
| 28 |
|
| 29 |
-
# %% dog-or-cat.ipynb 10
|
| 30 |
-
example_imgs_path = Path("../
|
| 31 |
img = gr.Image()
|
| 32 |
label = gr.Label()
|
| 33 |
examples = [
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../course22/vikas/dog-or-cat.ipynb.
|
| 2 |
|
| 3 |
# %% auto 0
|
| 4 |
__all__ = ['learner', 'categories', 'example_imgs_path', 'img', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
|
| 5 |
|
| 6 |
+
# %% ../course22/vikas/dog-or-cat.ipynb 2
|
| 7 |
# Imports
|
| 8 |
from fastai.vision.all import PILImage
|
| 9 |
from fastai.vision.all import load_learner
|
| 10 |
from pathlib import Path
|
| 11 |
import gradio as gr
|
| 12 |
|
| 13 |
+
# %% ../course22/vikas/dog-or-cat.ipynb 4
|
| 14 |
# Function to check if it is a cat
|
| 15 |
def is_cat(x): return x[0].isupper()
|
| 16 |
|
| 17 |
+
# %% ../course22/vikas/dog-or-cat.ipynb 6
|
| 18 |
# Load the trained model
|
| 19 |
learner = load_learner(fname="./dog_or_cat.pkl")
|
| 20 |
|
| 21 |
+
# %% ../course22/vikas/dog-or-cat.ipynb 8
|
| 22 |
categories = ("Cat", "Dog")
|
| 23 |
|
| 24 |
def classify_image(img):
|
|
|
|
| 26 |
print(pred, idx)
|
| 27 |
return dict(zip(categories, map(float, probs)))
|
| 28 |
|
| 29 |
+
# %% ../course22/vikas/dog-or-cat.ipynb 10
|
| 30 |
+
example_imgs_path = Path("../sample")
|
| 31 |
img = gr.Image()
|
| 32 |
label = gr.Label()
|
| 33 |
examples = [
|
sample/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
sample/cat.jpg
ADDED
|
Git LFS Details
|
sample/dog.jpg
ADDED
|
Git LFS Details
|
sample/dunno.jpg
ADDED
|
Git LFS Details
|