Spaces:
Sleeping
Sleeping
mwrites
commited on
Commit
·
3afcd30
1
Parent(s):
19eb685
init
Browse files- .gitattributes +1 -0
- .gitignore +46 -0
- app.py +20 -0
- model.pkl +3 -0
- multilabel_bird_on_horse.jpg +0 -0
- requirements.txt +2 -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 |
+
model.pkl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Compiled Python files
|
| 2 |
+
*.pyc
|
| 3 |
+
*.pyo
|
| 4 |
+
__pycache__/
|
| 5 |
+
|
| 6 |
+
# Setuptools build output
|
| 7 |
+
build/
|
| 8 |
+
dist/
|
| 9 |
+
|
| 10 |
+
# Python virtual environment
|
| 11 |
+
venv/
|
| 12 |
+
env/
|
| 13 |
+
|
| 14 |
+
# IDE and editor files
|
| 15 |
+
.vscode/
|
| 16 |
+
.idea/
|
| 17 |
+
*.pydevproject
|
| 18 |
+
*.pyc
|
| 19 |
+
*.bak
|
| 20 |
+
*.swp
|
| 21 |
+
*~.nib/
|
| 22 |
+
*.sublime-project
|
| 23 |
+
*.sublime-workspace
|
| 24 |
+
*.komodoproject
|
| 25 |
+
.komodotools/
|
| 26 |
+
*_iPython/
|
| 27 |
+
.ipynb_checkpoints/
|
| 28 |
+
.sage/
|
| 29 |
+
.spyderproject
|
| 30 |
+
.spyproject
|
| 31 |
+
.pytest_cache/
|
| 32 |
+
|
| 33 |
+
# Django specific files
|
| 34 |
+
*.log
|
| 35 |
+
*.pot
|
| 36 |
+
*.pyc
|
| 37 |
+
local_settings.py
|
| 38 |
+
|
| 39 |
+
# Database files
|
| 40 |
+
*.sqlite3
|
| 41 |
+
*.db
|
| 42 |
+
|
| 43 |
+
# Other generated files
|
| 44 |
+
*.bak
|
| 45 |
+
*.swp
|
| 46 |
+
*~
|
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
loaded_model = load_learner('model.pkl')
|
| 6 |
+
categories = loaded_model.dls.vocab
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def classify_image(img):
|
| 10 |
+
pred,idx,prob = loaded_model.predict(img)
|
| 11 |
+
return dict(zip(categories, map(float, prob)))
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
image = gr.components.Image(type="pil")
|
| 15 |
+
label = gr.components.Label()
|
| 16 |
+
examples = ['multilabel_bird_on_horse.jpg']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 20 |
+
iface.launch(inline=False)
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2afa0fcb99e726bad2bd249a44c49e71b222688dd4d607b55019dd831124589c
|
| 3 |
+
size 102985154
|
multilabel_bird_on_horse.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
fastai
|