Spaces:
Runtime error
Runtime error
Initial commit; trying to get all the binary files up there
Browse files- .gitattributes +1 -0
- app.py +27 -0
- black.jpg +3 -0
- grizzly.jpg +3 -0
- model.pkl +3 -0
- requirements.txt +2 -0
.gitattributes
CHANGED
@@ -31,3 +31,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
31 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
32 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
33 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
31 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
32 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
33 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: Lesson02.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'title', 'description', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
+
|
6 |
+
# %% Lesson02.ipynb 14
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
learn = load_learner('model.pkl')
|
11 |
+
|
12 |
+
categories = ('black', 'grizzly', 'panda', 'sloth', 'teddy')
|
13 |
+
|
14 |
+
def classify_image(img):
|
15 |
+
pred, idx, probs = learn.predict(img)
|
16 |
+
return dict(zip(categories, map(float, probs)))
|
17 |
+
|
18 |
+
title = "Bear discriminator"
|
19 |
+
description = "Identify different types of bears with fastai. Created as a demo for Gradio and HuggingFace Spaces."
|
20 |
+
|
21 |
+
image = gr.inputs.Image(shape=(192,192))
|
22 |
+
label = gr.outputs.Label()
|
23 |
+
examples = ['grizzly.jpg', 'black.jpg']
|
24 |
+
|
25 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples,
|
26 |
+
title=title, description=description)
|
27 |
+
intf.launch(inline=False)
|
black.jpg
ADDED
Git LFS Details
|
grizzly.jpg
ADDED
Git LFS Details
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:54cc6d88bec8566cda81645a7fa16b7e00bf72e531b4b062fbaad68ab763f748
|
3 |
+
size 46976929
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|