Added ALL THE BIRDS classes to the list
Browse files
app.py
CHANGED
@@ -61,9 +61,18 @@ def classify_image(image):
|
|
61 |
classification = labels[predicted.item()]
|
62 |
|
63 |
# Check if the predicted class is a bird
|
64 |
-
bird_categories = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
is_bird = ('bird' in classification.lower()) or any(category in classification.lower() for category in bird_categories)
|
66 |
-
|
67 |
# Get the confidence score
|
68 |
confidence_score = torch.nn.functional.softmax(output[0], dim=0)[predicted].item()
|
69 |
confidence_percentage = f"{confidence_score:.2%}"
|
|
|
61 |
classification = labels[predicted.item()]
|
62 |
|
63 |
# Check if the predicted class is a bird
|
64 |
+
bird_categories = [
|
65 |
+
'cock', 'hen', 'ostrich', 'brambling', 'goldfinch', 'house finch', 'junco', 'indigo bunting', 'robin',
|
66 |
+
'bulbul', 'jay', 'magpie', 'chickadee', 'water ouzel', 'kite', 'bald eagle', 'vulture', 'great grey owl',
|
67 |
+
'European fire salamander', 'ptarmigan', 'ruffed grouse', 'prairie chicken', 'peacock', 'quail', 'partridge',
|
68 |
+
'African grey', 'macaw', 'sulphur-crested cockatoo', 'lorikeet', 'coucal', 'bee eater', 'hornbill',
|
69 |
+
'hummingbird', 'jacamar', 'toucan', 'drake', 'red-breasted merganser', 'goose', 'black swan', 'white stork',
|
70 |
+
'black stork', 'spoonbill', 'flamingo', 'little blue heron', 'American egret', 'bittern', 'crane', 'limpkin',
|
71 |
+
'European gallinule', 'American coot', 'bustard', 'ruddy turnstone', 'red-backed sandpiper', 'redshank',
|
72 |
+
'dowitcher', 'oystercatcher', 'pelican', 'king penguin', 'albatross'
|
73 |
+
]
|
74 |
is_bird = ('bird' in classification.lower()) or any(category in classification.lower() for category in bird_categories)
|
75 |
+
#
|
76 |
# Get the confidence score
|
77 |
confidence_score = torch.nn.functional.softmax(output[0], dim=0)[predicted].item()
|
78 |
confidence_percentage = f"{confidence_score:.2%}"
|