Spaces:
Runtime error
Runtime error
Upload 6 files
Browse files- Common crested nuthatch.jpeg +0 -0
- Great Spotted Woodpecker.jpeg +0 -0
- README.md +6 -6
- app.py +17 -0
- requirements.txt +5 -0
- tint.jpeg +0 -0
Common crested nuthatch.jpeg
ADDED
|
Great Spotted Woodpecker.jpeg
ADDED
|
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title: Bird
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 3.
|
| 8 |
app_file: app.py
|
| 9 |
-
pinned:
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Bird-Detector
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 3.27.0
|
| 8 |
app_file: app.py
|
| 9 |
+
pinned: true
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
learn = load_learner('model.pkl')
|
| 5 |
+
|
| 6 |
+
categories = ('Common crested nuthatch', 'Great Spotted Woodpecker', 'Masked wagtail', 'Sparrow', 'Squirrel', 'Tit')
|
| 7 |
+
|
| 8 |
+
def classify_image (img):
|
| 9 |
+
pred, idx,probs = learn.predict (img)
|
| 10 |
+
return dict (zip(categories, map(float,probs)))
|
| 11 |
+
|
| 12 |
+
image = gr.inputs.Image(shape=(192,192))
|
| 13 |
+
label = gr.outputs.Label()
|
| 14 |
+
examples = ['tint.jpeg', 'Common crested nuthatch.jpeg', 'Great Spotted Woodpecker.jpeg']
|
| 15 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 16 |
+
intf.launch(inline=True)
|
| 17 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
torch
|
| 3 |
+
gradio
|
| 4 |
+
numpy
|
| 5 |
+
pandas
|
tint.jpeg
ADDED
|