Spaces:
Sleeping
Sleeping
Commit
·
b74e56c
1
Parent(s):
66d8c9d
add initial version
Browse files- .gitattributes +3 -0
- README.md +6 -0
- app.py +17 -0
- examples/airplane.jpg +3 -0
- examples/tree.jpg +3 -0
- export.pkl +3 -0
- requirements.txt +1 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ 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 |
+
export.pkl filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
examples/airplane.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
examples/tree.jpg filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -12,3 +12,9 @@ short_description: Tree detector
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
## Image credits
|
| 18 |
+
- `tree.jpg`: https://commons.wikimedia.org/wiki/File:Flooded_Albizia_Saman_(rain_tree)_in_the_Mekong.jpg. Basile Morin, CC BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0>, via Wikimedia Commons.
|
| 19 |
+
|
| 20 |
+
- `airplane.jpg`: https://commons.wikimedia.org/wiki/File:Emirates_Airbus_A380-861_A6-EER_MUC_2015_01.jpg. Julian Herzog, CC BY 4.0 <https://creativecommons.org/licenses/by/4.0>, via Wikimedia Commons.
|
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
learn = load_learner("export.pkl")
|
| 5 |
+
|
| 6 |
+
categories = ("Airplane", "Tree")
|
| 7 |
+
|
| 8 |
+
base_path = "examples/"
|
| 9 |
+
examples = ["tree.jpg", "airplane.jpg"]
|
| 10 |
+
examples = [base_path + filename for filename in examples]
|
| 11 |
+
|
| 12 |
+
def classify_image(img):
|
| 13 |
+
pred,idx,probs = learn.predict(img)
|
| 14 |
+
return dict(zip(categories, map(float,probs)))
|
| 15 |
+
|
| 16 |
+
demo = gr.Interface(fn=classify_image, inputs="image", outputs="text", examples=examples, live=True)
|
| 17 |
+
demo.launch()
|
examples/airplane.jpg
ADDED
|
Git LFS Details
|
examples/tree.jpg
ADDED
|
Git LFS Details
|
export.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:baeeb0d29b54329c0b4cd5657d5a9e5448eba6c6d0270d6e509340b3ea88fdfb
|
| 3 |
+
size 46961549
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastai==2.7.19
|