Spaces:
Sleeping
Sleeping
Deploy to huggingface spaces
Browse files- .DS_Store +0 -0
- .gitattributes +2 -0
- .gitignore +1 -0
- app.py +19 -0
- grizzly.jpg +3 -0
- model_resnet18.pkl +3 -0
- requirements.txt +3 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ 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 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
myenv/
|
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
|
| 4 |
+
learn = load_learner("model_resnet18.pkl")
|
| 5 |
+
labels = learn.dls.vocab
|
| 6 |
+
|
| 7 |
+
def predict(img):
|
| 8 |
+
img = PILImage.create(img)
|
| 9 |
+
pred, pred_idx, probs = learn.predict(img)
|
| 10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 11 |
+
|
| 12 |
+
gr.Interface(
|
| 13 |
+
fn=predict,
|
| 14 |
+
inputs=gr.Image(type="filepath"),
|
| 15 |
+
outputs=gr.Label(num_top_classes=3),
|
| 16 |
+
title="Bear Detector Classifier",
|
| 17 |
+
description="Fastai bear classifier demo",
|
| 18 |
+
examples=["grizzly.jpg"],
|
| 19 |
+
).launch()
|
grizzly.jpg
ADDED
|
Git LFS Details
|
model_resnet18.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be1df590dc2648ef70761fa7b7262802c641a077b55135a93c09b94f77d512f8
|
| 3 |
+
size 46982358
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
fastai
|
| 3 |
+
scikit-image
|