Spaces:
Sleeping
Sleeping
Commit
·
0921dad
1
Parent(s):
3514553
message
Browse files- .gitattributes +1 -0
- app.py +29 -0
- bear.jpeg +0 -0
- blackbear.jpg +0 -0
- model.pkl +3 -0
- requirements.txt +1 -0
.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 |
+
model.pkl filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: Bear Classifier (model uploaded).ipynb.
|
| 2 |
+
|
| 3 |
+
# %% auto 0
|
| 4 |
+
__all__ = ['model', 'categories', 'image', 'label', 'examples', 'intf', 'classify_images']
|
| 5 |
+
|
| 6 |
+
# %% Bear Classifier (model uploaded).ipynb 1
|
| 7 |
+
from fastai.vision.all import *
|
| 8 |
+
import gradio as gr
|
| 9 |
+
|
| 10 |
+
# %% Bear Classifier (model uploaded).ipynb 3
|
| 11 |
+
model = load_learner('model.pkl')
|
| 12 |
+
|
| 13 |
+
# %% Bear Classifier (model uploaded).ipynb 5
|
| 14 |
+
categories = ("black", "grizzly", "teddy")
|
| 15 |
+
|
| 16 |
+
def classify_images(img):
|
| 17 |
+
pred,idx,probs = model.predict(img)
|
| 18 |
+
return dict(zip(categories, map(float,probs)))
|
| 19 |
+
|
| 20 |
+
classify_images(im)
|
| 21 |
+
|
| 22 |
+
# %% Bear Classifier (model uploaded).ipynb 6
|
| 23 |
+
image = gr.inputs.Image(shape=(192, 192))
|
| 24 |
+
label = gr.outputs.Label()
|
| 25 |
+
examples = ['blackbear.jpg', 'bear.jpeg']
|
| 26 |
+
|
| 27 |
+
intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)
|
| 28 |
+
intf.launch(inline=False)
|
| 29 |
+
|
bear.jpeg
ADDED
|
blackbear.jpg
ADDED
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ea74d3db0b48cc44dcc2b3135771f1b8df36417658c8132d8f9140c9bc34227f
|
| 3 |
+
size 46961487
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastai
|