Spaces:
Runtime error
Runtime error
Upload everything!
Browse files- .gitattributes +1 -0
- 1.jpg +3 -0
- 2.jpg +3 -0
- 3.jpg +3 -0
- app.py +32 -0
- model.pkl +3 -0
- requirements.txt +2 -0
.gitattributes
CHANGED
|
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
1.jpg
ADDED
|
Git LFS Details
|
2.jpg
ADDED
|
Git LFS Details
|
3.jpg
ADDED
|
Git LFS Details
|
app.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).
|
| 2 |
+
|
| 3 |
+
__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'example', 'intf']
|
| 4 |
+
|
| 5 |
+
# Cell
|
| 6 |
+
|
| 7 |
+
from fastai.vision.all import *
|
| 8 |
+
import gradio as gr
|
| 9 |
+
|
| 10 |
+
# Cell
|
| 11 |
+
learn = load_learner('model.pkl')
|
| 12 |
+
|
| 13 |
+
# Cell
|
| 14 |
+
|
| 15 |
+
categories = learn.dls.vocab
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def classify_image(img):
|
| 19 |
+
pred, idx, probs = learn.predict(img)
|
| 20 |
+
return dict(zip(categories, map(float, probs)))
|
| 21 |
+
|
| 22 |
+
# Cell
|
| 23 |
+
|
| 24 |
+
image = gr.components.Image(shape=(224, 224))
|
| 25 |
+
label = gr.components.Label()
|
| 26 |
+
examples = ['1.jpg', '2.jpg', '3.jpg']
|
| 27 |
+
|
| 28 |
+
intf = gr.Interface(fn=classify_image,
|
| 29 |
+
inputs=image,
|
| 30 |
+
outputs=label,
|
| 31 |
+
examples=examples)
|
| 32 |
+
intf.launch(inline=False)
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fe8841712867a31c4c917b1685fe85da1e72dcb95c46af25551fdc4336c2bda4
|
| 3 |
+
size 201284453
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
timm
|