Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,25 +13,30 @@ import pathlib
|
|
13 |
temp = pathlib.WindowsPath
|
14 |
pathlib.WindowsPath = pathlib.PosixPath
|
15 |
|
16 |
-
model_dir = "models/parrot-recognizer-
|
17 |
|
18 |
model = load_learner(model_dir)
|
19 |
|
20 |
parrot_species = ['african grey parrot',
|
21 |
'australian king parrot',
|
|
|
|
|
|
|
|
|
22 |
'blue lorikeet',
|
23 |
-
'
|
24 |
-
'blue-headed parrot',
|
25 |
'budgerigar',
|
26 |
'burrowing parrot',
|
27 |
'caique parrot',
|
28 |
'catalina macaw',
|
29 |
'chestnut-fronted macaw',
|
|
|
30 |
'cockatiels',
|
31 |
'crimson rosella',
|
32 |
'cuban amazon',
|
33 |
'eclectus parrot',
|
34 |
-
'galah',
|
|
|
35 |
'golden parakeet',
|
36 |
'great green macaw',
|
37 |
'great hanging parrot',
|
@@ -42,31 +47,36 @@ parrot_species = ['african grey parrot',
|
|
42 |
'kea',
|
43 |
'kākāpō',
|
44 |
'lovebirds',
|
|
|
45 |
'monk parakeet',
|
46 |
-
'
|
47 |
'palm cockatoo',
|
48 |
'parrotlet',
|
49 |
-
'plum
|
50 |
'puerto rican amazon',
|
51 |
'rainbow lorikeet',
|
52 |
-
'red
|
53 |
-
'red
|
54 |
-
'red
|
55 |
-
'red
|
56 |
-
'red
|
57 |
-
'red
|
58 |
-
'
|
|
|
|
|
59 |
'saint vincent amazon',
|
|
|
60 |
'scarlet macaw',
|
61 |
'senegal parrot',
|
62 |
'spixs macaw',
|
|
|
63 |
'sun conure',
|
64 |
-
'thick
|
65 |
-
'turquoise
|
|
|
66 |
'vernal hanging parrot',
|
67 |
-
'
|
68 |
-
'yellow
|
69 |
-
'yellow-headed amazon']
|
70 |
|
71 |
def recognize_image(image):
|
72 |
pred, idx, probs = model.predict(image)
|
@@ -101,6 +111,11 @@ examples = [
|
|
101 |
"test_images/unknown_12.jpg",
|
102 |
"test_images/unknown_13.jpg",
|
103 |
"test_images/unknown_14.jpg",
|
|
|
|
|
|
|
|
|
|
|
104 |
]
|
105 |
|
106 |
iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
|
|
|
13 |
temp = pathlib.WindowsPath
|
14 |
pathlib.WindowsPath = pathlib.PosixPath
|
15 |
|
16 |
+
model_dir = "models/parrot-recognizer-v10.pkl"
|
17 |
|
18 |
model = load_learner(model_dir)
|
19 |
|
20 |
parrot_species = ['african grey parrot',
|
21 |
'australian king parrot',
|
22 |
+
'australian night parrot',
|
23 |
+
'bare eyed cockatoo',
|
24 |
+
'blue and yellow macaw',
|
25 |
+
'blue headed parrot',
|
26 |
'blue lorikeet',
|
27 |
+
'brown hooded parrot',
|
|
|
28 |
'budgerigar',
|
29 |
'burrowing parrot',
|
30 |
'caique parrot',
|
31 |
'catalina macaw',
|
32 |
'chestnut-fronted macaw',
|
33 |
+
'citron cockatoo',
|
34 |
'cockatiels',
|
35 |
'crimson rosella',
|
36 |
'cuban amazon',
|
37 |
'eclectus parrot',
|
38 |
+
'galah cockatoo',
|
39 |
+
'gang gang cockatoo',
|
40 |
'golden parakeet',
|
41 |
'great green macaw',
|
42 |
'great hanging parrot',
|
|
|
47 |
'kea',
|
48 |
'kākāpō',
|
49 |
'lovebirds',
|
50 |
+
'major mitchell_s cockatoo',
|
51 |
'monk parakeet',
|
52 |
+
'musk lorikeet',
|
53 |
'palm cockatoo',
|
54 |
'parrotlet',
|
55 |
+
'plum headed parakeet',
|
56 |
'puerto rican amazon',
|
57 |
'rainbow lorikeet',
|
58 |
+
'red breasted parakeet',
|
59 |
+
'red crowned amazon',
|
60 |
+
'red crowned parakeet',
|
61 |
+
'red fan parrot',
|
62 |
+
'red lory',
|
63 |
+
'red rumped parrot',
|
64 |
+
'red shouldered macaw',
|
65 |
+
'red tailed black cockatoos',
|
66 |
+
'rose ringed parakeet',
|
67 |
'saint vincent amazon',
|
68 |
+
'salmon crested cockatoo',
|
69 |
'scarlet macaw',
|
70 |
'senegal parrot',
|
71 |
'spixs macaw',
|
72 |
+
'sulpher crested cockatoo',
|
73 |
'sun conure',
|
74 |
+
'thick billed parrot',
|
75 |
+
'turquoise fronted amazon',
|
76 |
+
'umbrella cockatoo',
|
77 |
'vernal hanging parrot',
|
78 |
+
'yellow collared macaws',
|
79 |
+
'yellow headed amazon']
|
|
|
80 |
|
81 |
def recognize_image(image):
|
82 |
pred, idx, probs = model.predict(image)
|
|
|
111 |
"test_images/unknown_12.jpg",
|
112 |
"test_images/unknown_13.jpg",
|
113 |
"test_images/unknown_14.jpg",
|
114 |
+
"test_images/unknown_15.jpg",
|
115 |
+
"test_images/unknown_16.jpg",
|
116 |
+
"test_images/unknown_17.jpg",
|
117 |
+
"test_images/unknown_18.jpg",
|
118 |
+
"test_images/unknown_19.jpg",
|
119 |
]
|
120 |
|
121 |
iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
|