Keyven commited on
Commit
305daae
Β·
1 Parent(s): 5b8d6e6

Upload 6 files

Browse files
Common crested nuthatch.jpeg ADDED
Great Spotted Woodpecker.jpeg ADDED
README.md CHANGED
@@ -1,12 +1,12 @@
1
  ---
2
- title: Bird Detector
3
- emoji: πŸ‘€
4
- colorFrom: blue
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 3.41.2
8
  app_file: app.py
9
- pinned: false
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