Spaces:
Sleeping
Sleeping
hkanumilli
commited on
Commit
·
6ffed6b
1
Parent(s):
b4518ea
Hummingbird Classifier
Browse files- annas.jpeg +0 -0
- app.py +22 -0
- green-crowned.jpeg +0 -0
- marvelous_spatuletail.png +0 -0
- requirements.txt +1 -0
- resnet101model_2.pkl +3 -0
- ruby-throated.jpeg +0 -0
- violetear.jpeg +0 -0
annas.jpeg
ADDED
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# def is_cat(x): return x[0].isupper()
|
5 |
+
|
6 |
+
# Cell
|
7 |
+
learn = load_learner('resnet101model.pkl')
|
8 |
+
|
9 |
+
# Cell
|
10 |
+
categories = ("anna's", 'green-crowned', 'marvelous spatuletail', 'ruby-throated', 'violetear')
|
11 |
+
|
12 |
+
def classify_image(img):
|
13 |
+
pred,idx,probs = learn.predict(img)
|
14 |
+
return dict(zip(categories, map(float,probs)))
|
15 |
+
|
16 |
+
# Cell
|
17 |
+
image = gr.inputs.Image(shape=(224, 224))
|
18 |
+
label = gr.outputs.Label()
|
19 |
+
examples = ['annas.jpeg', 'green-crowned.jpeg', 'marvelous_spatuletail.png', 'ruby-throated.jpeg', 'violetear.jpeg']
|
20 |
+
|
21 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
22 |
+
intf.launch(inline=False)
|
green-crowned.jpeg
ADDED
marvelous_spatuletail.png
ADDED
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|
resnet101model_2.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7a6a03ef2c7bc5db46a61f956695192d278f892ad25768524fd28c1c0c15560b
|
3 |
+
size 179208241
|
ruby-throated.jpeg
ADDED
violetear.jpeg
ADDED