Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files
.gitattributes
CHANGED
|
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
dog.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../drive/MyDrive/Colab Notebooks/cats_vs_dogs.ipynb.
|
| 2 |
+
|
| 3 |
+
# %% auto 0
|
| 4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
| 5 |
+
|
| 6 |
+
# %% ../drive/MyDrive/Colab Notebooks/cats_vs_dogs.ipynb 10
|
| 7 |
+
!pip install -q gradio
|
| 8 |
import gradio as gr
|
| 9 |
|
| 10 |
+
# %% ../drive/MyDrive/Colab Notebooks/cats_vs_dogs.ipynb 12
|
| 11 |
+
learn = load_learner('pets.pkl')
|
| 12 |
+
|
| 13 |
+
# %% ../drive/MyDrive/Colab Notebooks/cats_vs_dogs.ipynb 14
|
| 14 |
+
categories = ('Dog', 'Cat')
|
| 15 |
+
|
| 16 |
+
def classify_image(img):
|
| 17 |
+
pred,idx,probs = learn.predict(img)
|
| 18 |
+
return dict(zip(categories, map(float,probs)))
|
| 19 |
+
classify_image(im)
|
| 20 |
+
|
| 21 |
+
# %% ../drive/MyDrive/Colab Notebooks/cats_vs_dogs.ipynb 15
|
| 22 |
+
image = gr.inputs.Image(shape=(192, 192))
|
| 23 |
+
label = gr.outputs.Label()
|
| 24 |
+
examples = ['dog.jpg']
|
| 25 |
|
| 26 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 27 |
+
intf.launch(inline=False)
|
dog.jpg
ADDED
|
Git LFS Details
|
pets.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:86e85227fa293cf98739dc3643f912de639fd70347a01e544dab8d7c43349854
|
| 3 |
+
size 102978534
|