Spaces:
Sleeping
Sleeping
Initial commit
Browse files- .gitattributes +1 -0
- =0.15.0 +29 -0
- Dockerfile +58 -0
- app/__init__.py +0 -0
- app/__pycache__/__init__.cpython-312.pyc +0 -0
- app/__pycache__/main.cpython-312.pyc +0 -0
- app/faiss_embedding/animal_embeddings.pt +3 -0
- app/faiss_embedding/animal_species_list.txt +624 -0
- app/faiss_embedding/bioclip_animal_embeddings.pt +3 -0
- app/faiss_embedding/bioclip_animal_index.faiss +3 -0
- app/faiss_embedding/bioclip_metadata.json +40 -0
- app/main.py +86 -0
- app/models/__pycache__/animal_vision.cpython-312.pyc +0 -0
- app/models/__pycache__/llm.cpython-312.pyc +0 -0
- app/models/__pycache__/plant_vision.cpython-312.pyc +0 -0
- app/models/animal_vision.py +82 -0
- app/models/llm.py +182 -0
- app/models/plant_vision.py +58 -0
- app/utils/__pycache__/config.cpython-312.pyc +0 -0
- app/utils/config.py +24 -0
- requirements.txt +21 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
app/faiss_embedding/bioclip_animal_index.faiss filter=lfs diff=lfs merge=lfs -text
|
=0.15.0
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Requirement already satisfied: torchvision in /usr/local/lib/python3.12/dist-packages (0.24.0+cu126)
|
| 2 |
+
Requirement already satisfied: numpy in /usr/local/lib/python3.12/dist-packages (from torchvision) (2.0.2)
|
| 3 |
+
Requirement already satisfied: torch==2.9.0 in /usr/local/lib/python3.12/dist-packages (from torchvision) (2.9.0+cu126)
|
| 4 |
+
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.12/dist-packages (from torchvision) (11.3.0)
|
| 5 |
+
Requirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (3.20.3)
|
| 6 |
+
Requirement already satisfied: typing-extensions>=4.10.0 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (4.15.0)
|
| 7 |
+
Requirement already satisfied: setuptools in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (75.2.0)
|
| 8 |
+
Requirement already satisfied: sympy>=1.13.3 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (1.14.0)
|
| 9 |
+
Requirement already satisfied: networkx>=2.5.1 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (3.6.1)
|
| 10 |
+
Requirement already satisfied: jinja2 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (3.1.6)
|
| 11 |
+
Requirement already satisfied: fsspec>=0.8.5 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (2025.3.0)
|
| 12 |
+
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.6.77 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (12.6.77)
|
| 13 |
+
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.6.77 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (12.6.77)
|
| 14 |
+
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.6.80 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (12.6.80)
|
| 15 |
+
Requirement already satisfied: nvidia-cudnn-cu12==9.10.2.21 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (9.10.2.21)
|
| 16 |
+
Requirement already satisfied: nvidia-cublas-cu12==12.6.4.1 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (12.6.4.1)
|
| 17 |
+
Requirement already satisfied: nvidia-cufft-cu12==11.3.0.4 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (11.3.0.4)
|
| 18 |
+
Requirement already satisfied: nvidia-curand-cu12==10.3.7.77 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (10.3.7.77)
|
| 19 |
+
Requirement already satisfied: nvidia-cusolver-cu12==11.7.1.2 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (11.7.1.2)
|
| 20 |
+
Requirement already satisfied: nvidia-cusparse-cu12==12.5.4.2 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (12.5.4.2)
|
| 21 |
+
Requirement already satisfied: nvidia-cusparselt-cu12==0.7.1 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (0.7.1)
|
| 22 |
+
Requirement already satisfied: nvidia-nccl-cu12==2.27.5 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (2.27.5)
|
| 23 |
+
Requirement already satisfied: nvidia-nvshmem-cu12==3.3.20 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (3.3.20)
|
| 24 |
+
Requirement already satisfied: nvidia-nvtx-cu12==12.6.77 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (12.6.77)
|
| 25 |
+
Requirement already satisfied: nvidia-nvjitlink-cu12==12.6.85 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (12.6.85)
|
| 26 |
+
Requirement already satisfied: nvidia-cufile-cu12==1.11.1.6 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (1.11.1.6)
|
| 27 |
+
Requirement already satisfied: triton==3.5.0 in /usr/local/lib/python3.12/dist-packages (from torch==2.9.0->torchvision) (3.5.0)
|
| 28 |
+
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.12/dist-packages (from sympy>=1.13.3->torch==2.9.0->torchvision) (1.3.0)
|
| 29 |
+
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.12/dist-packages (from jinja2->torch==2.9.0->torchvision) (3.0.3)
|
Dockerfile
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
ENV PYTHONUNBUFFERED=1
|
| 6 |
+
ENV HF_HOME=/data/huggingface
|
| 7 |
+
ENV TRANSFORMERS_CACHE=/data/huggingface
|
| 8 |
+
ENV TORCH_HOME=/data/torch
|
| 9 |
+
ENV XDG_CACHE_HOME=/data/cache
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
RUN apt-get update && apt-get install -y \
|
| 13 |
+
git \
|
| 14 |
+
curl \
|
| 15 |
+
ca-certificates \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
WORKDIR /app
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
COPY requirements.txt .
|
| 23 |
+
RUN pip install --upgrade pip \
|
| 24 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
RUN python - <<EOF
|
| 28 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoImageProcessor, AutoModelForImageClassification
|
| 29 |
+
import open_clip
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
QWEN_MODEL_ID = "Qwen/Qwen2.5-1.5B-Instruct"
|
| 33 |
+
AutoTokenizer.from_pretrained(QWEN_MODEL_ID, trust_remote_code=True)
|
| 34 |
+
AutoModelForCausalLM.from_pretrained(
|
| 35 |
+
QWEN_MODEL_ID,
|
| 36 |
+
trust_remote_code=True,
|
| 37 |
+
device_map="cpu"
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
PLANT_MODEL_ID = "drrobot9/BIONEXUS_PLANT_CLASSIFICATION"
|
| 42 |
+
AutoImageProcessor.from_pretrained(PLANT_MODEL_ID)
|
| 43 |
+
AutoModelForImageClassification.from_pretrained(PLANT_MODEL_ID)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
open_clip.create_model_and_transforms("hf-hub:imageomics/bioclip")
|
| 47 |
+
|
| 48 |
+
print("Models cached successfully for Hugging Face Spaces.")
|
| 49 |
+
EOF
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
COPY app ./app
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
EXPOSE 7860
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
app/__init__.py
ADDED
|
File without changes
|
app/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (152 Bytes). View file
|
|
|
app/__pycache__/main.cpython-312.pyc
ADDED
|
Binary file (3.01 kB). View file
|
|
|
app/faiss_embedding/animal_embeddings.pt
ADDED
|
@@ -0,0 +1,3 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elas (black-backed jackal)
|
| 8 |
+
Vulpes vulpes (red fox)
|
| 9 |
+
Vulpes lagopus (Arctic fox)
|
| 10 |
+
Vulpes zerda (fennec fox)
|
| 11 |
+
Vulpes macrotis (kit fox)
|
| 12 |
+
Urocyon cinereoargenteus (gray fox)
|
| 13 |
+
Nyctereutes procyonoides (raccoon dog)
|
| 14 |
+
Otocyon megalotis (bat-eared fox)
|
| 15 |
+
Lycaon pictus (African wild dog)
|
| 16 |
+
Cuon alpinus (dhole)
|
| 17 |
+
Speothos venaticus (bush dog)
|
| 18 |
+
Atelocynus microtis (short-eared dog)
|
| 19 |
+
Chrysocyon brachyurus (maned wolf)
|
| 20 |
+
Felis catus (domestic cat)
|
| 21 |
+
Felis silvestris (European wildcat)
|
| 22 |
+
Felis nigripes (black-footed cat)
|
| 23 |
+
Felis chaus (jungle cat)
|
| 24 |
+
Felis margarita (sand cat)
|
| 25 |
+
Felis bieti (Chinese mountain cat)
|
| 26 |
+
Panthera leo (lion)
|
| 27 |
+
Panthera tigris (tiger)
|
| 28 |
+
Panthera pardus (leopard)
|
| 29 |
+
Panthera onca (jaguar)
|
| 30 |
+
Panthera uncia (snow leopard)
|
| 31 |
+
Acinonyx jubatus (cheetah)
|
| 32 |
+
Puma concolor (cougar)
|
| 33 |
+
Puma yagouaroundi (jaguarundi)
|
| 34 |
+
Lynx lynx (Eurasian lynx)
|
| 35 |
+
Lynx canadensis (Canadian lynx)
|
| 36 |
+
Lynx rufus (bobcat)
|
| 37 |
+
Lynx pardinus (Iberian lynx)
|
| 38 |
+
Leopardus pardalis (ocelot)
|
| 39 |
+
Leopardus wiedii (margay)
|
| 40 |
+
Leopardus tigrinus (oncilla)
|
| 41 |
+
Prionailurus bengalensis (leopard cat)
|
| 42 |
+
Prionailurus viverrinus (fishing cat)
|
| 43 |
+
Caracal caracal (caracal)
|
| 44 |
+
Leptailurus serval (serval)
|
| 45 |
+
Ursus arctos (brown bear)
|
| 46 |
+
Ursus maritimus (polar bear)
|
| 47 |
+
Ursus americanus (American black bear)
|
| 48 |
+
Ursus thibetanus (Asian black bear)
|
| 49 |
+
Ursus malayanus (sun bear)
|
| 50 |
+
Ursus ursinus (sloth bear)
|
| 51 |
+
Melursus ursinus (Sri Lankan sloth bear)
|
| 52 |
+
Ailuropoda melanoleuca (giant panda)
|
| 53 |
+
Mustela erminea (stoat)
|
| 54 |
+
Mustela nivalis (least weasel)
|
| 55 |
+
Mustela putorius (European polecat)
|
| 56 |
+
Mustela frenata (long-tailed weasel)
|
| 57 |
+
Neovison vison (American mink)
|
| 58 |
+
Martes martes (European pine marten)
|
| 59 |
+
Martes foina (beech marten)
|
| 60 |
+
Martes americana (American marten)
|
| 61 |
+
Martes pennanti (fellow)
|
| 62 |
+
Gulo gulo (wolverine)
|
| 63 |
+
Meles meles (European badger)
|
| 64 |
+
Taxidea taxus (American badger)
|
| 65 |
+
Lutra lutra (European otter)
|
| 66 |
+
Lontra canadensis (North American river otter)
|
| 67 |
+
Enhydra lutris (sea otter)
|
| 68 |
+
Aonyx cinerea (Asian small-clawed otter)
|
| 69 |
+
Pteronura brasiliensis (giant otter)
|
| 70 |
+
Mellivora capensis (honey badger)
|
| 71 |
+
Ictonyx striatus (striped polecat)
|
| 72 |
+
Rattus norvegicus (brown rat)
|
| 73 |
+
Rattus rattus (black rat)
|
| 74 |
+
Mus musculus (house mouse)
|
| 75 |
+
Apodemus sylvaticus (wood mouse)
|
| 76 |
+
Peromyscus maniculatus (deer mouse)
|
| 77 |
+
Microtus arvalis (common vole)
|
| 78 |
+
Microtus agrestis (field vole)
|
| 79 |
+
Arvicola amphibius (water vole)
|
| 80 |
+
Myodes glareolus (bank vole)
|
| 81 |
+
Ondatra zibethicus (muskrat)
|
| 82 |
+
Castor fiber (European beaver)
|
| 83 |
+
Castor canadensis (North American beaver)
|
| 84 |
+
Sciurus vulgaris (red squirrel)
|
| 85 |
+
Sciurus carolinensis (gray squirrel)
|
| 86 |
+
Tamiasciurus hudsonicus (red squirrel)
|
| 87 |
+
Marmota marmota (Alpine marmot)
|
| 88 |
+
Marmota monax (groundhog)
|
| 89 |
+
Cynomys ludovicianus (black-tailed prairie dog)
|
| 90 |
+
Cavia porcellus (guinea pig)
|
| 91 |
+
Cavia aperea (Brazilian guinea pig)
|
| 92 |
+
Chinchilla lanigera (chinchilla)
|
| 93 |
+
Chinchilla chinchilla (short-tailed chinchilla)
|
| 94 |
+
Dipodomys merriami (Merriam's kangaroo rat)
|
| 95 |
+
Jaculus jaculus (lesser Egyptian jerboa)
|
| 96 |
+
Hystrix cristata (crested porcupine)
|
| 97 |
+
Erethizon dorsatum (North American porcupine)
|
| 98 |
+
Coendou prehensilis (Brazilian porcupine)
|
| 99 |
+
Dasyprocta leporina (red-rumped agouti)
|
| 100 |
+
Dasyprocta punctata (Central American agouti)
|
| 101 |
+
Cuniculus paca (lowland paca)
|
| 102 |
+
Hydrochoerus hydrochaeris (capybara)
|
| 103 |
+
Myocastor coypus (coypu)
|
| 104 |
+
Octodon degus (degu)
|
| 105 |
+
Meriones unguiculatus (Mongolian gerbil)
|
| 106 |
+
Mesocricetus auratus (golden hamster)
|
| 107 |
+
Phodopus sungorus (Djungarian hamster)
|
| 108 |
+
Cricetulus griseus (Chinese hamster)
|
| 109 |
+
Glis glis (edible dormouse)
|
| 110 |
+
Eliomys quercinus (garden dormouse)
|
| 111 |
+
Dryomys nitedula (forest dormouse)
|
| 112 |
+
Muscardinus avellanarius (hazel dormouse)
|
| 113 |
+
Lemmus lemmus (Norway lemming)
|
| 114 |
+
Dicrostonyx groenlandicus (collared lemming)
|
| 115 |
+
Oryctolagus cuniculus (European rabbit)
|
| 116 |
+
Sylvilagus floridanus (eastern cottontail)
|
| 117 |
+
Sylvilagus audubonii (desert cottontail)
|
| 118 |
+
Lepus europaeus (European hare)
|
| 119 |
+
Lepus americanus (snowshoe hare)
|
| 120 |
+
Lepus timidus (mountain hare)
|
| 121 |
+
Pteropus vampyrus (large flying fox)
|
| 122 |
+
Pteropus giganteus (Indian flying fox)
|
| 123 |
+
Rousettus aegyptiacus (Egyptian fruit bat)
|
| 124 |
+
Eidolon helvum (straw-colored fruit bat)
|
| 125 |
+
Desmodus rotundus (common vampire bat)
|
| 126 |
+
Diphylla ecaudata (hairy-legged vampire bat)
|
| 127 |
+
Myotis myotis (greater mouse-eared bat)
|
| 128 |
+
Myotis lucifugus (little brown bat)
|
| 129 |
+
Myotis daubentonii (Daubenton's bat)
|
| 130 |
+
Nyctalus noctula (common noctule)
|
| 131 |
+
Pipistrellus pipistrellus (common pipistrelle)
|
| 132 |
+
Pipistrellus kuhlii (Kuhl's pipistrelle)
|
| 133 |
+
Eptesicus serotinus (serotine bat)
|
| 134 |
+
Miniopterus schreibersii (common bent-wing bat)
|
| 135 |
+
Rhinolophus ferrumequinum (greater horseshoe bat)
|
| 136 |
+
Rhinolophus hipposideros (lesser horseshoe bat)
|
| 137 |
+
Megaderma lyra (greater false vampire bat)
|
| 138 |
+
Phyllostomus hastatus (greater spear-nosed bat)
|
| 139 |
+
Mormoops megalophylla (ghost-faced bat)
|
| 140 |
+
Molossus molossus (velvety free-tailed bat)
|
| 141 |
+
Homo sapiens (human)
|
| 142 |
+
Gorilla gorilla (western gorilla)
|
| 143 |
+
Gorilla beringei (eastern gorilla)
|
| 144 |
+
Pan troglodytes (chimpanzee)
|
| 145 |
+
Pan paniscus (bonobo)
|
| 146 |
+
Pongo abelii (Sumatran orangutan)
|
| 147 |
+
Pongo pygmaeus (Bornean orangutan)
|
| 148 |
+
Hylobates lar (lar gibbon)
|
| 149 |
+
Hylobates moloch (silvery gibbon)
|
| 150 |
+
Symphalangus syndactylus (siamang)
|
| 151 |
+
Nomascus leucogenys (white-cheeked gibbon)
|
| 152 |
+
Macaca mulatta (rhesus macaque)
|
| 153 |
+
Macaca fascicularis (crab-eating macaque)
|
| 154 |
+
Macaca fuscata (Japanese macaque)
|
| 155 |
+
Macaca sylvanus (Barbary macaque)
|
| 156 |
+
Papio anubis (olive baboon)
|
| 157 |
+
Papio cynocephalus (yellow baboon)
|
| 158 |
+
Papio ursinus (chacma baboon)
|
| 159 |
+
Theropithecus gelada (gelada)
|
| 160 |
+
Mandrillus sphinx (mandrill)
|
| 161 |
+
Mandrillus leucophaeus (drill)
|
| 162 |
+
Cercocebus atys (sooty mangabey)
|
| 163 |
+
Chlorocebus aethiops (vervet monkey)
|
| 164 |
+
Cercopithecus mitis (blue monkey)
|
| 165 |
+
Cercopithecus neglectus (De Brazza's monkey)
|
| 166 |
+
Colobus guereza (mantled guereza)
|
| 167 |
+
Piliocolobus badius (western red colobus)
|
| 168 |
+
Presbytis melalophos (mitred leaf monkey)
|
| 169 |
+
Nasalis larvatus (proboscis monkey)
|
| 170 |
+
Alouatta palliata (mantled howler)
|
| 171 |
+
Giraffa camelopardalis (giraffe)
|
| 172 |
+
Okapia johnstoni (okapi)
|
| 173 |
+
Camelus dromedarius (dromedary camel)
|
| 174 |
+
Camelus bactrianus (Bactrian camel)
|
| 175 |
+
Lama glama (llama)
|
| 176 |
+
Lama guanicoe (guanaco)
|
| 177 |
+
Vicugna vicugna (vicuña)
|
| 178 |
+
Vicugna pacos (alpaca)
|
| 179 |
+
Cervus elaphus (red deer)
|
| 180 |
+
Cervus canadensis (elk)
|
| 181 |
+
Alces alces (moose)
|
| 182 |
+
Rangifer tarandus (reindeer/caribou)
|
| 183 |
+
Capreolus capreolus (roe deer)
|
| 184 |
+
Odocoileus virginianus (white-tailed deer)
|
| 185 |
+
Odocoileus hemionus (mule deer)
|
| 186 |
+
Dama dama (fallow deer)
|
| 187 |
+
Hydropotes inermis (water deer)
|
| 188 |
+
Bos taurus (cattle)
|
| 189 |
+
Bos indicus (zebu)
|
| 190 |
+
Bison bison (American bison)
|
| 191 |
+
Bison bonasus (European bison)
|
| 192 |
+
Bubalus bubalis (water buffalo)
|
| 193 |
+
Syncerus caffer (African buffalo)
|
| 194 |
+
Ovis aries (sheep)
|
| 195 |
+
Capra aegagrus hircus (goat)
|
| 196 |
+
Capra ibex (Alpine ibex)
|
| 197 |
+
Rupicapra rupicapra (chamois)
|
| 198 |
+
Aepyceros melampus (impala)
|
| 199 |
+
Connochaetes taurinus (blue wildebeest)
|
| 200 |
+
Connochaetes gnou (black wildebeest)
|
| 201 |
+
Damaliscus pygargus (bontebok)
|
| 202 |
+
Alcelaphus buselaphus (hartebeest)
|
| 203 |
+
Kobus ellipsiprymnus (waterbuck)
|
| 204 |
+
Redunca redunca (bohor reedbuck)
|
| 205 |
+
Hippotragus niger (sable antelope)
|
| 206 |
+
Hippotragus equinus (roan antelope)
|
| 207 |
+
Oryx gazella (gemsbok)
|
| 208 |
+
Addax nasomaculatus (addax)
|
| 209 |
+
Taurotragus oryx (common eland)
|
| 210 |
+
Taurotragus derbianus (giant eland)
|
| 211 |
+
Tragelaphus strepsiceros (greater kudu)
|
| 212 |
+
Tragelaphus scriptus (bushbuck)
|
| 213 |
+
Tragelaphus eurycerus (bongo)
|
| 214 |
+
Neotragus moschatus (suni)
|
| 215 |
+
Madoqua kirkii (Kirk's dik-dik)
|
| 216 |
+
Rhynchotragus kirki (Guenther's dik-dik)
|
| 217 |
+
Gazella dorcas (dorcas gazelle)
|
| 218 |
+
Gazella thomsonii (Thomson's gazelle)
|
| 219 |
+
Nanger granti (Grant's gazelle)
|
| 220 |
+
Antidorcas marsupialis (springbok)
|
| 221 |
+
Saiga tatarica (saiga antelope)
|
| 222 |
+
Pantholops hodgsonii (Tibetan antelope)
|
| 223 |
+
Equus ferus caballus (horse)
|
| 224 |
+
Equus asinus (donkey)
|
| 225 |
+
Equus zebra (mountain zebra)
|
| 226 |
+
Equus quagga (plains zebra)
|
| 227 |
+
Equus grevyi (Grévy's zebra)
|
| 228 |
+
Equus hemionus (Asiatic wild ass)
|
| 229 |
+
Equus kiang (kiang)
|
| 230 |
+
Rhinoceros unicornis (Indian rhinoceros)
|
| 231 |
+
Rhinoceros sondaicus (Javan rhinoceros)
|
| 232 |
+
Diceros bicornis (black rhinoceros)
|
| 233 |
+
Ceratotherium simum (white rhinoceros)
|
| 234 |
+
Tapirus terrestris (Brazilian tapir)
|
| 235 |
+
Tapirus indicus (Malayan tapir)
|
| 236 |
+
Tapirus bairdii (Baird's tapir)
|
| 237 |
+
Tapirus pinchaque (mountain tapir)
|
| 238 |
+
Sus scrofa domesticus (pig)
|
| 239 |
+
Sus scrofa (wild boar)
|
| 240 |
+
Phacochoerus africanus (common warthog)
|
| 241 |
+
Phacochoerus aethiopicus (desert warthog)
|
| 242 |
+
Potamochoerus porcus (red river hog)
|
| 243 |
+
Babyrousa babyrussa (babirusa)
|
| 244 |
+
Hippopotamus amphibius (hippopotamus)
|
| 245 |
+
Choeropsis liberiensis (pygmy hippopotamus)
|
| 246 |
+
Loxodonta africana (African elephant)
|
| 247 |
+
Elephas maximus (Asian elephant)
|
| 248 |
+
Dugong dugon (dugong)
|
| 249 |
+
Trichechus manatus (West Indian manatee)
|
| 250 |
+
Trichechus senegalensis (West African manatee)
|
| 251 |
+
Trichechus inunguis (Amazonian manatee)
|
| 252 |
+
Procavia capensis (rock hyrax)
|
| 253 |
+
Dendrohyrax arboreus (tree hyrax)
|
| 254 |
+
Heterohyrax brucei (yellow-spotted rock hyrax)
|
| 255 |
+
Aquila chrysaetos (golden eagle)
|
| 256 |
+
Haliaeetus leucocephalus (bald eagle)
|
| 257 |
+
Haliaeetus albicilla (white-tailed eagle)
|
| 258 |
+
Circus cyaneus (hen harrier)
|
| 259 |
+
Accipiter gentilis (northern goshawk)
|
| 260 |
+
Accipiter nisus (Eurasian sparrowhawk)
|
| 261 |
+
Buteo buteo (common buzzard)
|
| 262 |
+
Buteo jamaicensis (red-tailed hawk)
|
| 263 |
+
Pernis apivorus (European honey buzzard)
|
| 264 |
+
Milvus milvus (red kite)
|
| 265 |
+
Neophron percnopterus (Egyptian vulture)
|
| 266 |
+
Gyps fulvus (griffon vulture)
|
| 267 |
+
Gypaetus barbatus (bearded vulture)
|
| 268 |
+
Falco peregrinus (peregrine falcon)
|
| 269 |
+
Falco tinnunculus (common kestrel)
|
| 270 |
+
Falco columbarius (merlin)
|
| 271 |
+
Bubo bubo (Eurasian eagle-owl)
|
| 272 |
+
Strix aluco (tawny owl)
|
| 273 |
+
Tyto alba (barn owl)
|
| 274 |
+
Athene noctua (little owl)
|
| 275 |
+
Corvus corax (common raven)
|
| 276 |
+
Corvus corone (carrion crow)
|
| 277 |
+
Corvus brachyrhynchos (American crow)
|
| 278 |
+
Corvus monedula (Eurasian jackdaw)
|
| 279 |
+
Pica pica (Eurasian magpie)
|
| 280 |
+
Cyanocitta cristata (blue jay)
|
| 281 |
+
Garrulus glandarius (Eurasian jay)
|
| 282 |
+
Sturnus vulgaris (common starling)
|
| 283 |
+
Turdus merula (common blackbird)
|
| 284 |
+
Turdus migratorius (American robin)
|
| 285 |
+
Erithacus rubecula (European robin)
|
| 286 |
+
Luscinia megarhynchos (common nightingale)
|
| 287 |
+
Sylvia atricapilla (Eurasian blackcap)
|
| 288 |
+
Phylloscopus trochilus (willow warbler)
|
| 289 |
+
Parus major (great tit)
|
| 290 |
+
Cyanistes caeruleus (blue tit)
|
| 291 |
+
Passer domesticus (house sparrow)
|
| 292 |
+
Passer montanus (Eurasian tree sparrow)
|
| 293 |
+
Fringilla coelebs (common chaffinch)
|
| 294 |
+
Carduelis carduelis (European goldfinch)
|
| 295 |
+
Serinus canaria (Atlantic canary)
|
| 296 |
+
Coccothraustes coccothraustes (hawfinch)
|
| 297 |
+
Pyrrhula pyrrhula (Eurasian bullfinch)
|
| 298 |
+
Emberiza citrinella (yellowhammer)
|
| 299 |
+
Alauda arvensis (Eurasian skylark)
|
| 300 |
+
Hirundo rustica (barn swallow)
|
| 301 |
+
Delichon urbicum (common house martin)
|
| 302 |
+
Apus apus (common swift)
|
| 303 |
+
Troglodytes troglodytes (Eurasian wren)
|
| 304 |
+
Regulus regulus (goldcrest)
|
| 305 |
+
Motacilla alba (white wagtail)
|
| 306 |
+
Anthus trivialis (tree pipit)
|
| 307 |
+
Lanius collurio (red-backed shrike)
|
| 308 |
+
Oriolus oriolus (Eurasian golden oriole)
|
| 309 |
+
Anas platyrhynchos (mallard)
|
| 310 |
+
Anas crecca (Eurasian teal)
|
| 311 |
+
Anas strepera (gadwall)
|
| 312 |
+
Aythya fuligula (tufted duck)
|
| 313 |
+
Cygnus olor (mute swan)
|
| 314 |
+
Cygnus cygnus (whooper swan)
|
| 315 |
+
Branta canadensis (Canada goose)
|
| 316 |
+
Anser anser (greylag goose)
|
| 317 |
+
Mergus merganser (common merganser)
|
| 318 |
+
Somateria mollissima (common eider)
|
| 319 |
+
Alopochen aegyptiaca (Egyptian goose)
|
| 320 |
+
Tadorna tadorna (common shelduck)
|
| 321 |
+
Netta rufina (red-crested pochard)
|
| 322 |
+
Aix sponsa (wood duck)
|
| 323 |
+
Oxyura jamaicensis (ruddy duck)
|
| 324 |
+
Bucephala clangula (common goldeneye)
|
| 325 |
+
Gallus gallus domesticus (chicken)
|
| 326 |
+
Meleagris gallopavo (wild turkey)
|
| 327 |
+
Phasianus colchicus (common pheasant)
|
| 328 |
+
Coturnix coturnix (common quail)
|
| 329 |
+
Perdix perdix (grey partridge)
|
| 330 |
+
Alectoris chukar (chukar partridge)
|
| 331 |
+
Lagopus lagopus (willow ptarmigan)
|
| 332 |
+
Lagopus muta (rock ptarmigan)
|
| 333 |
+
Tetrao urogallus (western capercaillie)
|
| 334 |
+
Bonasa bonasia (hazel grouse)
|
| 335 |
+
Melopsittacus undulatus (budgerigar)
|
| 336 |
+
Nymphicus hollandicus (cockatiel)
|
| 337 |
+
Ara macao (scarlet macaw)
|
| 338 |
+
Ara ararauna (blue-and-yellow macaw)
|
| 339 |
+
Amazona aestiva (turquoise-fronted amazon)
|
| 340 |
+
Psittacus erithacus (African grey parrot)
|
| 341 |
+
Cacatua galerita (sulphur-crested cockatoo)
|
| 342 |
+
Cacatua moluccensis (salmon-crested cockatoo)
|
| 343 |
+
Columba livia (rock pigeon)
|
| 344 |
+
Columba palumbus (common wood pigeon)
|
| 345 |
+
Streptopelia decaocto (Eurasian collared dove)
|
| 346 |
+
Streptopelia turtur (European turtle dove)
|
| 347 |
+
Aptenodytes forsteri (emperor penguin)
|
| 348 |
+
Aptenodytes patagonicus (king penguin)
|
| 349 |
+
Pygoscelis adeliae (Adélie penguin)
|
| 350 |
+
Pygoscelis antarcticus (chinstrap penguin)
|
| 351 |
+
Pygoscelis papua (gentoo penguin)
|
| 352 |
+
Eudyptula minor (little penguin)
|
| 353 |
+
Spheniscus demersus (African penguin)
|
| 354 |
+
Spheniscus humboldti (Humboldt penguin)
|
| 355 |
+
Spheniscus magellanicus (Magellanic penguin)
|
| 356 |
+
Eudyptes chrysocome (rockhopper penguin)
|
| 357 |
+
Megadyptes antipodes (yellow-eyed penguin)
|
| 358 |
+
Phoenicopterus roseus (greater flamingo)
|
| 359 |
+
Phoenicopterus chilensis (Chilean flamingo)
|
| 360 |
+
Phoeniconaias minor (lesser flamingo)
|
| 361 |
+
Phoenicoparrus andinus (Andean flamingo)
|
| 362 |
+
Phoenicoparrus jamesi (James's flamingo)
|
| 363 |
+
Python regius (ball python)
|
| 364 |
+
Python bivittatus (Burmese python)
|
| 365 |
+
Python molurus (Indian python)
|
| 366 |
+
Morelia viridis (green tree python)
|
| 367 |
+
Boa constrictor (boa constrictor)
|
| 368 |
+
Eunectes murinus (green anaconda)
|
| 369 |
+
Epicrates cenchria (rainbow boa)
|
| 370 |
+
Corallus caninus (emerald tree boa)
|
| 371 |
+
Crotalus atrox (western diamondback rattlesnake)
|
| 372 |
+
Crotalus adamanteus (eastern diamondback rattlesnake)
|
| 373 |
+
Crotalus viridis (prairie rattlesnake)
|
| 374 |
+
Sistrurus catenatus (massasauga)
|
| 375 |
+
Agkistrodon contortrix (copperhead)
|
| 376 |
+
Agkistrodon piscivorus (cottonmouth)
|
| 377 |
+
Vipera berus (common European viper)
|
| 378 |
+
Vipera ammodytes (nose-horned viper)
|
| 379 |
+
Naja naja (Indian cobra)
|
| 380 |
+
Naja kaouthia (monocled cobra)
|
| 381 |
+
Ophiophagus hannah (king cobra)
|
| 382 |
+
Dendroaspis polylepis (black mamba)
|
| 383 |
+
Dendroaspis angusticeps (eastern green mamba)
|
| 384 |
+
Bungarus multicinctus (many-banded krait)
|
| 385 |
+
Lampropeltis getula (common kingsnake)
|
| 386 |
+
Pantherophis guttatus (corn snake)
|
| 387 |
+
Pantherophis obsoletus (rat snake)
|
| 388 |
+
Thamnophis sirtalis (common garter snake)
|
| 389 |
+
Nerodia sipedon (northern water snake)
|
| 390 |
+
Iguana iguana (green iguana)
|
| 391 |
+
Ctenosaura similis (black iguana)
|
| 392 |
+
Conolophus subcristatus (Galapagos land iguana)
|
| 393 |
+
Amblyrhynchus cristatus (marine iguana)
|
| 394 |
+
Varanus komodoensis (Komodo dragon)
|
| 395 |
+
Varanus salvator (water monitor)
|
| 396 |
+
Varanus niloticus (Nile monitor)
|
| 397 |
+
Chamaeleo calyptratus (veiled chameleon)
|
| 398 |
+
Furcifer pardalis (panther chameleon)
|
| 399 |
+
Trioceros jacksonii (Jackson's chameleon)
|
| 400 |
+
Pogona vitticeps (bearded dragon)
|
| 401 |
+
Uromastyx aegyptia (Egyptian spiny-tailed lizard)
|
| 402 |
+
Heloderma suspectum (Gila monster)
|
| 403 |
+
Heloderma horridum (Mexican beaded lizard)
|
| 404 |
+
Gekko gecko (tokay gecko)
|
| 405 |
+
Phelsuma madagascariensis (Madagascar day gecko)
|
| 406 |
+
Eublepharis macularius (leopard gecko)
|
| 407 |
+
Correlophus ciliatus (crested gecko)
|
| 408 |
+
Rhacodactylus auriculatus (gargoyle gecko)
|
| 409 |
+
Tiliqua scincoides (blue-tongued skink)
|
| 410 |
+
Plestiodon fasciatus (five-lined skink)
|
| 411 |
+
Scincus scincus (sandfish skink)
|
| 412 |
+
Podarcis muralis (common wall lizard)
|
| 413 |
+
Lacerta agilis (sand lizard)
|
| 414 |
+
Zootoca vivipara (viviparous lizard)
|
| 415 |
+
Chelonia mydas (green sea turtle)
|
| 416 |
+
Caretta caretta (loggerhead sea turtle)
|
| 417 |
+
Eretmochelys imbricata (hawksbill sea turtle)
|
| 418 |
+
Dermochelys coriacea (leatherback sea turtle)
|
| 419 |
+
Lepidochelys olivacea (olive ridley sea turtle)
|
| 420 |
+
Trachemys scripta (pond slider)
|
| 421 |
+
Chrysemys picta (painted turtle)
|
| 422 |
+
Emys orbicularis (European pond turtle)
|
| 423 |
+
Mauremys reevesii (Chinese pond turtle)
|
| 424 |
+
Terrapene carolina (common box turtle)
|
| 425 |
+
Geochelone elegans (Indian star tortoise)
|
| 426 |
+
Centrochelys sulcata (African spurred tortoise)
|
| 427 |
+
Testudo graeca (Greek tortoise)
|
| 428 |
+
Testudo hermanni (Hermann's tortoise)
|
| 429 |
+
Gopherus polyphemus (gopher tortoise)
|
| 430 |
+
Chelonoidis carbonarius (red-footed tortoise)
|
| 431 |
+
Kinosternon subrubrum (eastern mud turtle)
|
| 432 |
+
Sternotherus odoratus (common musk turtle)
|
| 433 |
+
Crocodylus niloticus (Nile crocodile)
|
| 434 |
+
Crocodylus porosus (saltwater crocodile)
|
| 435 |
+
Crocodylus acutus (American crocodile)
|
| 436 |
+
Alligator mississippiensis (American alligator)
|
| 437 |
+
Alligator sinensis (Chinese alligator)
|
| 438 |
+
Caiman crocodilus (spectacled caiman)
|
| 439 |
+
Melanosuchus niger (black caiman)
|
| 440 |
+
Gavialis gangeticus (gharial)
|
| 441 |
+
Tomistoma schlegelii (false gharial)
|
| 442 |
+
Sphenodon punctatus (tuatara)
|
| 443 |
+
Rana temporaria (common frog)
|
| 444 |
+
Rana catesbeiana (American bullfrog)
|
| 445 |
+
Lithobates pipiens (northern leopard frog)
|
| 446 |
+
Pelophylax ridibundus (marsh frog)
|
| 447 |
+
Bufo bufo (common toad)
|
| 448 |
+
Bufo americanus (American toad)
|
| 449 |
+
Anaxyrus terrestris (southern toad)
|
| 450 |
+
Rhinella marina (cane toad)
|
| 451 |
+
Dendrobates tinctorius (dyeing poison dart frog)
|
| 452 |
+
Dendrobates auratus (green and black poison dart frog)
|
| 453 |
+
Phyllobates terribilis (golden poison frog)
|
| 454 |
+
Epipedobates tricolor (Phantasmal poison frog)
|
| 455 |
+
Agalychnis callidryas (red-eyed tree frog)
|
| 456 |
+
Litoria caerulea (green tree frog)
|
| 457 |
+
Hyla arborea (European tree frog)
|
| 458 |
+
Pseudacris crucifer (spring peeper)
|
| 459 |
+
Xenopus laevis (African clawed frog)
|
| 460 |
+
Ambystoma mexicanum (axolotl)
|
| 461 |
+
Ambystoma tigrinum (tiger salamander)
|
| 462 |
+
Salamandra salamandra (fire salamander)
|
| 463 |
+
Triturus cristatus (great crested newt)
|
| 464 |
+
Lissotriton vulgaris (smooth newt)
|
| 465 |
+
Notophthalmus viridescens (eastern newt)
|
| 466 |
+
Cryptobranchus alleganiensis (hellbender)
|
| 467 |
+
Andrias davidianus (Chinese giant salamander)
|
| 468 |
+
Salmo salar (Atlantic salmon)
|
| 469 |
+
Oncorhynchus mykiss (rainbow trout)
|
| 470 |
+
Oncorhynchus tshawytscha (chinook salmon)
|
| 471 |
+
Salmo trutta (brown trout)
|
| 472 |
+
Thunnus thynnus (Atlantic bluefin tuna)
|
| 473 |
+
Katsuwonus pelamis (skipjack tuna)
|
| 474 |
+
Xiphias gladius (swordfish)
|
| 475 |
+
Carcharodon carcharias (great white shark)
|
| 476 |
+
Rhincodon typus (whale shark)
|
| 477 |
+
Sphyrna mokarran (great hammerhead shark)
|
| 478 |
+
Galeocerdo cuvier (tiger shark)
|
| 479 |
+
Squalus acanthias (spiny dogfish)
|
| 480 |
+
Manta birostris (giant oceanic manta ray)
|
| 481 |
+
Dasyatis pastinaca (common stingray)
|
| 482 |
+
Hippocampus hippocampus (short-snouted seahorse)
|
| 483 |
+
Hippocampus erectus (lined seahorse)
|
| 484 |
+
Cyprinus carpio (common carp)
|
| 485 |
+
Carassius auratus (goldfish)
|
| 486 |
+
Pygocentrus nattereri (red-bellied piranha)
|
| 487 |
+
Serrasalmus rhombeus (white piranha)
|
| 488 |
+
Pterophyllum scalare (freshwater angelfish)
|
| 489 |
+
Symphysodon aequifasciatus (discus fish)
|
| 490 |
+
Betta splendens (Siamese fighting fish)
|
| 491 |
+
Macropodus opercularis (paradise fish)
|
| 492 |
+
Poecilia reticulata (guppy)
|
| 493 |
+
Xiphophorus hellerii (green swordtail)
|
| 494 |
+
Amphiprion ocellaris (clownfish)
|
| 495 |
+
Paracanthurus hepatus (blue tang)
|
| 496 |
+
Zebrasoma flavescens (yellow tang)
|
| 497 |
+
Acanthurus leucosternon (powder blue tang)
|
| 498 |
+
Centropyge loriculus (flame angelfish)
|
| 499 |
+
Pomacanthus imperator (emperor angelfish)
|
| 500 |
+
Chaetodon auriga (threadfin butterflyfish)
|
| 501 |
+
Chelmon rostratus (copperband butterflyfish)
|
| 502 |
+
Naso lituratus (orangespine unicornfish)
|
| 503 |
+
Siganus vulpinus (foxface rabbitfish)
|
| 504 |
+
Delphinus delphis (common dolphin)
|
| 505 |
+
Tursiops truncatus (bottlenose dolphin)
|
| 506 |
+
Orcinus orca (killer whale)
|
| 507 |
+
Globicephala melas (long-finned pilot whale)
|
| 508 |
+
Phocoena phocoena (harbor porpoise)
|
| 509 |
+
Physeter macrocephalus (sperm whale)
|
| 510 |
+
Balaenoptera musculus (blue whale)
|
| 511 |
+
Megaptera novaeangliae (humpback whale)
|
| 512 |
+
Eubalaena glacialis (North Atlantic right whale)
|
| 513 |
+
Balaenoptera physalus (fin whale)
|
| 514 |
+
Monodon monoceros (narwhal)
|
| 515 |
+
Delphinapterus leucas (beluga whale)
|
| 516 |
+
Phoca vitulina (harbor seal)
|
| 517 |
+
Halichoerus grypus (gray seal)
|
| 518 |
+
Mirounga leonina (southern elephant seal)
|
| 519 |
+
Leptonychotes weddellii (Weddell seal)
|
| 520 |
+
Odobenus rosmarus (walrus)
|
| 521 |
+
Eumetopias jubatus (Steller sea lion)
|
| 522 |
+
Zalophus californianus (California sea lion)
|
| 523 |
+
Otaria flavescens (South American sea lion)
|
| 524 |
+
Lontra felina (marine otter)
|
| 525 |
+
Danaus plexippus (monarch butterfly)
|
| 526 |
+
Papilio machaon (common yellow swallowtail)
|
| 527 |
+
Pieris rapae (small white butterfly)
|
| 528 |
+
Aglais io (European peacock butterfly)
|
| 529 |
+
Vanessa atalanta (red admiral butterfly)
|
| 530 |
+
Polyommatus icarus (common blue butterfly)
|
| 531 |
+
Apis mellifera (western honey bee)
|
| 532 |
+
Bombus terrestris (buff-tailed bumblebee)
|
| 533 |
+
Bombus lapidarius (red-tailed bumblebee)
|
| 534 |
+
Xylocopa virginica (eastern carpenter bee)
|
| 535 |
+
Formica rufa (red wood ant)
|
| 536 |
+
Lasius niger (black garden ant)
|
| 537 |
+
Solenopsis invicta (red imported fire ant)
|
| 538 |
+
Atta cephalotes (leafcutter ant)
|
| 539 |
+
Coccinella septempunctata (seven-spot ladybird)
|
| 540 |
+
Harmonia axyridis (harlequin ladybird)
|
| 541 |
+
Lucanus cervus (European stag beetle)
|
| 542 |
+
Oryctes nasicornis (European rhinoceros beetle)
|
| 543 |
+
Carabus violaceus (violet ground beetle)
|
| 544 |
+
Calosoma sycophanta (forest caterpillar hunter)
|
| 545 |
+
Tenebrio molitor (yellow mealworm)
|
| 546 |
+
Tribolium castaneum (red flour beetle)
|
| 547 |
+
Aedes aegypti (yellow fever mosquito)
|
| 548 |
+
Culex pipiens (common house mosquito)
|
| 549 |
+
Anopheles gambiae (African malaria mosquito)
|
| 550 |
+
Musca domestica (housefly)
|
| 551 |
+
Calliphora vicina (blue bottle fly)
|
| 552 |
+
Drosophila melanogaster (fruit fly)
|
| 553 |
+
Periplaneta americana (American cockroach)
|
| 554 |
+
Blattella germanica (German cockroach)
|
| 555 |
+
Blatta orientalis (oriental cockroach)
|
| 556 |
+
Gryllus bimaculatus (field cricket)
|
| 557 |
+
Acheta domesticus (house cricket)
|
| 558 |
+
Locusta migratoria (migratory locust)
|
| 559 |
+
Schistocerca gregaria (desert locust)
|
| 560 |
+
Carausius morosus (Indian stick insect)
|
| 561 |
+
Phasmatodea (walking stick)
|
| 562 |
+
Mantis religiosa (European mantis)
|
| 563 |
+
Tenodera sinensis (Chinese mantis)
|
| 564 |
+
Libellula depressa (broad-bodied chaser)
|
| 565 |
+
Aeshna juncea (common hawker)
|
| 566 |
+
Sympetrum striolatum (common darter)
|
| 567 |
+
Latrodectus mactans (southern black widow)
|
| 568 |
+
Latrodectus hesperus (western black widow)
|
| 569 |
+
Loxosceles reclusa (brown recluse spider)
|
| 570 |
+
Tegenaria domestica (barn funnel weaver)
|
| 571 |
+
Araneus diadematus (European garden spider)
|
| 572 |
+
Argiope bruennichi (wasp spider)
|
| 573 |
+
Pholcus phalangioides (daddy long-legs spider)
|
| 574 |
+
Salticus scenicus (zebra jumping spider)
|
| 575 |
+
Theraphosa blondi (Goliath birdeater)
|
| 576 |
+
Brachypelma smithi (Mexican redknee tarantula)
|
| 577 |
+
Grammostola rosea (Chilean rose tarantula)
|
| 578 |
+
Androctonus australis (fat-tailed scorpion)
|
| 579 |
+
Centruroides vittatus (striped bark scorpion)
|
| 580 |
+
Hadrurus arizonensis (giant desert hairy scorpion)
|
| 581 |
+
Ixodes scapularis (black-legged tick)
|
| 582 |
+
Dermacentor variabilis (American dog tick)
|
| 583 |
+
Amblyomma americanum (lone star tick)
|
| 584 |
+
Sarcoptes scabiei (itch mite)
|
| 585 |
+
Varroa destructor (Varroa mite)
|
| 586 |
+
Tetranychus urticae (two-spotted spider mite)
|
| 587 |
+
Homarus americanus (American lobster)
|
| 588 |
+
Homarus gammarus (European lobster)
|
| 589 |
+
Nephrops norvegicus (Norway lobster)
|
| 590 |
+
Cancer pagurus (edible crab)
|
| 591 |
+
Callinectes sapidus (blue crab)
|
| 592 |
+
Carcinus maenas (European green crab)
|
| 593 |
+
Scylla serrata (mud crab)
|
| 594 |
+
Portunus trituberculatus (blue swimming crab)
|
| 595 |
+
Pandalus borealis (northern prawn)
|
| 596 |
+
Litopenaeus vannamei (whiteleg shrimp)
|
| 597 |
+
Penaeus monodon (giant tiger prawn)
|
| 598 |
+
Artemia salina (brine shrimp)
|
| 599 |
+
Daphnia magna (water flea)
|
| 600 |
+
Gammarus pulex (freshwater shrimp)
|
| 601 |
+
Oniscus asellus (common woodlouse)
|
| 602 |
+
Octopus vulgaris (common octopus)
|
| 603 |
+
Enteroctopus dofleini (giant Pacific octopus)
|
| 604 |
+
Sepia officinalis (common cuttlefish)
|
| 605 |
+
Loligo vulgaris (common squid)
|
| 606 |
+
Architeuthis dux (giant squid)
|
| 607 |
+
Helix pomatia (Roman snail)
|
| 608 |
+
Cornu aspersum (garden snail)
|
| 609 |
+
Achatina fulica (giant African snail)
|
| 610 |
+
Crassostrea gigas (Pacific oyster)
|
| 611 |
+
Ostrea edulis (European flat oyster)
|
| 612 |
+
Mytilus edulis (blue mussel)
|
| 613 |
+
Pecten maximus (great scallop)
|
| 614 |
+
Tridacna gigas (giant clam)
|
| 615 |
+
Lymnaea stagnalis (great pond snail)
|
| 616 |
+
Biomphalaria glabrata (bloodfluke planorb)
|
| 617 |
+
Mammuthus primigenius (woolly mammoth)
|
| 618 |
+
Smilodon fatalis (saber-toothed cat)
|
| 619 |
+
Tyrannosaurus rex (T-Rex)
|
| 620 |
+
Triceratops horridus (triceratops)
|
| 621 |
+
Velociraptor mongoliensis (velociraptor)
|
| 622 |
+
Pterodactylus antiquus (pterodactyl)
|
| 623 |
+
Megalodon (giant shark)
|
| 624 |
+
Dodo (Raphus cucullatus)
|
app/faiss_embedding/bioclip_animal_embeddings.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abe2fbe73e4a8619b5cd36ccc35974c84d1416da7afc6e42b9706ddd2df22547
|
| 3 |
+
size 1068775
|
app/faiss_embedding/bioclip_animal_index.faiss
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44c25c19d4927e79504360382da9e24e51a6863c5faae134543395a092a8cd93
|
| 3 |
+
size 1277997
|
app/faiss_embedding/bioclip_metadata.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "imageomics/bioclip",
|
| 3 |
+
"num_animals": 624,
|
| 4 |
+
"embedding_dim": 512,
|
| 5 |
+
"contains_microorganisms": false,
|
| 6 |
+
"curated_animals_only": true,
|
| 7 |
+
"animal_categories": {
|
| 8 |
+
"mammals": 64,
|
| 9 |
+
"birds": 15,
|
| 10 |
+
"reptiles": 28,
|
| 11 |
+
"amphibians": 19,
|
| 12 |
+
"fish": 27,
|
| 13 |
+
"insects": 77
|
| 14 |
+
},
|
| 15 |
+
"device": "cuda",
|
| 16 |
+
"batch_size": 64,
|
| 17 |
+
"save_directory": "/content/drive/MyDrive/BIONEXUS_PROJECT/app/faiss_embedding",
|
| 18 |
+
"sample_animals": [
|
| 19 |
+
"Canis lupus familiaris (domestic dog)",
|
| 20 |
+
"Canis lupus (gray wolf)",
|
| 21 |
+
"Canis latrans (coyote)",
|
| 22 |
+
"Canis aureus (golden jackal)",
|
| 23 |
+
"Canis simensis (Ethiopian wolf)",
|
| 24 |
+
"Canis adustus (side-striped jackal)",
|
| 25 |
+
"Canis mesomelas (black-backed jackal)",
|
| 26 |
+
"Vulpes vulpes (red fox)",
|
| 27 |
+
"Vulpes lagopus (Arctic fox)",
|
| 28 |
+
"Vulpes zerda (fennec fox)",
|
| 29 |
+
"Vulpes macrotis (kit fox)",
|
| 30 |
+
"Urocyon cinereoargenteus (gray fox)",
|
| 31 |
+
"Nyctereutes procyonoides (raccoon dog)",
|
| 32 |
+
"Otocyon megalotis (bat-eared fox)",
|
| 33 |
+
"Lycaon pictus (African wild dog)",
|
| 34 |
+
"Cuon alpinus (dhole)",
|
| 35 |
+
"Speothos venaticus (bush dog)",
|
| 36 |
+
"Atelocynus microtis (short-eared dog)",
|
| 37 |
+
"Chrysocyon brachyurus (maned wolf)",
|
| 38 |
+
"Felis catus (domestic cat)"
|
| 39 |
+
]
|
| 40 |
+
}
|
app/main.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/main.py
|
| 2 |
+
|
| 3 |
+
from fastapi import FastAPI, HTTPException
|
| 4 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
+
from pydantic import BaseModel, HttpUrl
|
| 6 |
+
from PIL import Image
|
| 7 |
+
import requests
|
| 8 |
+
import io
|
| 9 |
+
|
| 10 |
+
from app.models.animal_vision import predict_animal
|
| 11 |
+
from app.models.plant_vision import predict_plant
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
app = FastAPI(
|
| 16 |
+
title="BIONEXUS Image Intelligence API",
|
| 17 |
+
version="1.0.0"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
app.add_middleware(
|
| 21 |
+
CORSMiddleware,
|
| 22 |
+
allow_origins=["*"],
|
| 23 |
+
allow_credentials=True,
|
| 24 |
+
allow_methods=["*"],
|
| 25 |
+
allow_headers=["*"],
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class ImageURLRequest(BaseModel):
|
| 32 |
+
image_url: HttpUrl
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def load_image_from_url(url) -> Image.Image:
|
| 36 |
+
url = str(url)
|
| 37 |
+
|
| 38 |
+
headers = {
|
| 39 |
+
"User-Agent": (
|
| 40 |
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
| 41 |
+
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
| 42 |
+
"Chrome/121.0.0.0 Safari/537.36"
|
| 43 |
+
),
|
| 44 |
+
"Accept": "image/avif,image/webp,image/apng,image/*,*/*;q=0.8",
|
| 45 |
+
"Accept-Language": "en-US,en;q=0.9",
|
| 46 |
+
"Referer": url
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
try:
|
| 50 |
+
response = requests.get(
|
| 51 |
+
url,
|
| 52 |
+
headers=headers,
|
| 53 |
+
timeout=10
|
| 54 |
+
)
|
| 55 |
+
response.raise_for_status()
|
| 56 |
+
except requests.RequestException as e:
|
| 57 |
+
raise HTTPException(
|
| 58 |
+
status_code=400,
|
| 59 |
+
detail=f"Failed to download image: {str(e)}"
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
try:
|
| 63 |
+
image = Image.open(io.BytesIO(response.content)).convert("RGB")
|
| 64 |
+
except Exception:
|
| 65 |
+
raise HTTPException(
|
| 66 |
+
status_code=400,
|
| 67 |
+
detail="Invalid or unsupported image format"
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
return image
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
@app.post("/animal/predict")
|
| 78 |
+
async def animal_predict(payload: ImageURLRequest):
|
| 79 |
+
image = load_image_from_url(payload.image_url)
|
| 80 |
+
return predict_animal(image)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
@app.post("/plant/predict")
|
| 84 |
+
async def plant_predict(payload: ImageURLRequest):
|
| 85 |
+
image = load_image_from_url(payload.image_url)
|
| 86 |
+
return predict_plant(image)
|
app/models/__pycache__/animal_vision.cpython-312.pyc
ADDED
|
Binary file (2.79 kB). View file
|
|
|
app/models/__pycache__/llm.cpython-312.pyc
ADDED
|
Binary file (5.55 kB). View file
|
|
|
app/models/__pycache__/plant_vision.cpython-312.pyc
ADDED
|
Binary file (1.89 kB). View file
|
|
|
app/models/animal_vision.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/models/animal_vision.py
|
| 2 |
+
|
| 3 |
+
import faiss
|
| 4 |
+
import torch
|
| 5 |
+
import open_clip
|
| 6 |
+
import numpy as np
|
| 7 |
+
from PIL import Image
|
| 8 |
+
|
| 9 |
+
from app.models.llm import explain_species
|
| 10 |
+
from app.utils.config import (
|
| 11 |
+
DEVICE,
|
| 12 |
+
BIOCLIP_MODEL_ID,
|
| 13 |
+
BIOCLIP_INDEX_PATH,
|
| 14 |
+
ANIMAL_SPECIES_LIST,
|
| 15 |
+
TOP_K_ANIMALS
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
model, _, preprocess = open_clip.create_model_and_transforms(
|
| 21 |
+
f"hf-hub:{BIOCLIP_MODEL_ID}"
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
model = model.to(DEVICE)
|
| 25 |
+
model.eval()
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
index = faiss.read_index(str(BIOCLIP_INDEX_PATH))
|
| 31 |
+
|
| 32 |
+
with open(ANIMAL_SPECIES_LIST, "r", encoding="utf-8") as f:
|
| 33 |
+
SPECIES = [line.strip() for line in f]
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
@torch.no_grad()
|
| 39 |
+
def predict_animal(image: Image.Image):
|
| 40 |
+
"""
|
| 41 |
+
Returns:
|
| 42 |
+
{
|
| 43 |
+
"species": str,
|
| 44 |
+
"common_name": str | None,
|
| 45 |
+
"confidence": float,
|
| 46 |
+
"top_k": list,
|
| 47 |
+
"description": str
|
| 48 |
+
}
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
image_tensor = preprocess(image.convert("RGB"))
|
| 52 |
+
image_tensor = image_tensor.unsqueeze(0).to(DEVICE)
|
| 53 |
+
|
| 54 |
+
image_features = model.encode_image(image_tensor)
|
| 55 |
+
image_features = image_features / image_features.norm(dim=-1, keepdim=True)
|
| 56 |
+
|
| 57 |
+
image_np = image_features.cpu().numpy().astype("float32")
|
| 58 |
+
scores, indices = index.search(image_np, TOP_K_ANIMALS)
|
| 59 |
+
|
| 60 |
+
results = []
|
| 61 |
+
for idx, score in zip(indices[0], scores[0]):
|
| 62 |
+
results.append({
|
| 63 |
+
"species": SPECIES[idx],
|
| 64 |
+
"similarity": float(score)
|
| 65 |
+
})
|
| 66 |
+
|
| 67 |
+
best = results[0]
|
| 68 |
+
|
| 69 |
+
llm_result = explain_species(
|
| 70 |
+
species=best["species"],
|
| 71 |
+
confidence=best["similarity"],
|
| 72 |
+
domain="animal",
|
| 73 |
+
top_k=results
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
return {
|
| 77 |
+
"species": best["species"],
|
| 78 |
+
"common_name": llm_result["common_name"],
|
| 79 |
+
"confidence": best["similarity"],
|
| 80 |
+
"top_k": results,
|
| 81 |
+
"description": llm_result["description"],
|
| 82 |
+
}
|
app/models/llm.py
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/models/llm.py
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import torch
|
| 5 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 6 |
+
from app.utils.config import DEVICE, QWEN_MODEL_ID
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 12 |
+
QWEN_MODEL_ID,
|
| 13 |
+
trust_remote_code=True
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 17 |
+
QWEN_MODEL_ID,
|
| 18 |
+
device_map="auto" if DEVICE == "cuda" else None,
|
| 19 |
+
torch_dtype=torch.float16 if DEVICE == "cuda" else torch.float32,
|
| 20 |
+
trust_remote_code=True
|
| 21 |
+
)
|
| 22 |
+
model.eval()
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def strip_markdown(text: str) -> str:
|
| 27 |
+
text = re.sub(r"\*\*(.*?)\*\*", r"\1", text)
|
| 28 |
+
text = re.sub(r"\*(.*?)\*", r"\1", text)
|
| 29 |
+
text = re.sub(r"#+\s*", "", text)
|
| 30 |
+
text = re.sub(r"-\s+", "", text)
|
| 31 |
+
text = re.sub(r"`+", "", text)
|
| 32 |
+
text = text.replace("---", "")
|
| 33 |
+
return text.strip()
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
@torch.no_grad()
|
| 39 |
+
def infer_common_name(
|
| 40 |
+
species: str,
|
| 41 |
+
domain: str,
|
| 42 |
+
max_tokens: int = 16,
|
| 43 |
+
) -> str | None:
|
| 44 |
+
"""
|
| 45 |
+
Uses LLM to infer the most widely accepted English common name.
|
| 46 |
+
Returns None if no common name exists.
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
messages = [
|
| 50 |
+
{
|
| 51 |
+
"role": "system",
|
| 52 |
+
"content": (
|
| 53 |
+
"You are a taxonomy assistant. "
|
| 54 |
+
"Return ONLY the most widely used English common name "
|
| 55 |
+
"for the given scientific name. "
|
| 56 |
+
"Do not explain or add extra text."
|
| 57 |
+
"dont respond null for common name make sure u provide a common name"
|
| 58 |
+
)
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"role": "user",
|
| 62 |
+
"content": f"Scientific name: {species} ({domain})"
|
| 63 |
+
}
|
| 64 |
+
]
|
| 65 |
+
|
| 66 |
+
text = tokenizer.apply_chat_template(
|
| 67 |
+
messages,
|
| 68 |
+
tokenize=False,
|
| 69 |
+
add_generation_prompt=True
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 73 |
+
|
| 74 |
+
outputs = model.generate(
|
| 75 |
+
**inputs,
|
| 76 |
+
max_new_tokens=max_tokens,
|
| 77 |
+
do_sample=False,
|
| 78 |
+
temperature=0.0,
|
| 79 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
generated_ids = outputs[:, inputs.input_ids.shape[1]:]
|
| 83 |
+
response = tokenizer.decode(
|
| 84 |
+
generated_ids[0],
|
| 85 |
+
skip_special_tokens=True
|
| 86 |
+
).strip()
|
| 87 |
+
|
| 88 |
+
if not response or response.lower() == "none":
|
| 89 |
+
return None
|
| 90 |
+
|
| 91 |
+
return response
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def _build_messages(
|
| 97 |
+
species: str,
|
| 98 |
+
confidence: float,
|
| 99 |
+
domain: str,
|
| 100 |
+
top_k: list | None = None,
|
| 101 |
+
):
|
| 102 |
+
alternatives = ""
|
| 103 |
+
if top_k:
|
| 104 |
+
alternatives = "\n".join(
|
| 105 |
+
[f"{x['species']} ({x['similarity']:.2f})" for x in top_k[1:]]
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
system_message = (
|
| 109 |
+
"You are a scientific biodiversity assistant. "
|
| 110 |
+
"Provide factual, neutral descriptions of species. "
|
| 111 |
+
"Do not mention instructions, rules, or formatting. "
|
| 112 |
+
"Do not use markdown or bullet points."
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
user_message = (
|
| 116 |
+
f"Species: {species}\n"
|
| 117 |
+
f"Confidence: {confidence:.2f}\n\n"
|
| 118 |
+
f"Alternative candidates:\n"
|
| 119 |
+
f"{alternatives if alternatives else 'None'}\n\n"
|
| 120 |
+
"Provide a factual description covering physical traits, "
|
| 121 |
+
"natural habitat and distribution, diet or ecological role, "
|
| 122 |
+
"conservation status, and relevant human interactions. "
|
| 123 |
+
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
return [
|
| 127 |
+
{"role": "system", "content": system_message},
|
| 128 |
+
{"role": "user", "content": user_message},
|
| 129 |
+
]
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
@torch.no_grad()
|
| 134 |
+
def explain_species(
|
| 135 |
+
species: str,
|
| 136 |
+
confidence: float,
|
| 137 |
+
domain: str,
|
| 138 |
+
top_k: list | None = None,
|
| 139 |
+
max_tokens: int = 512,
|
| 140 |
+
):
|
| 141 |
+
"""
|
| 142 |
+
Returns:
|
| 143 |
+
{
|
| 144 |
+
"common_name": str | None,
|
| 145 |
+
"description": str
|
| 146 |
+
}
|
| 147 |
+
"""
|
| 148 |
+
|
| 149 |
+
COMMON_NAME_MIN_CONFIDENCE = 0.01
|
| 150 |
+
common_name = None
|
| 151 |
+
|
| 152 |
+
if confidence >= COMMON_NAME_MIN_CONFIDENCE:
|
| 153 |
+
common_name = infer_common_name(species, domain)
|
| 154 |
+
|
| 155 |
+
messages = _build_messages(species, confidence, domain, top_k)
|
| 156 |
+
|
| 157 |
+
text = tokenizer.apply_chat_template(
|
| 158 |
+
messages,
|
| 159 |
+
tokenize=False,
|
| 160 |
+
add_generation_prompt=True
|
| 161 |
+
)
|
| 162 |
+
|
| 163 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 164 |
+
|
| 165 |
+
outputs = model.generate(
|
| 166 |
+
**model_inputs,
|
| 167 |
+
max_new_tokens=max_tokens,
|
| 168 |
+
do_sample=False,
|
| 169 |
+
temperature=0.0,
|
| 170 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 171 |
+
)
|
| 172 |
+
|
| 173 |
+
generated_ids = outputs[:, model_inputs.input_ids.shape[1]:]
|
| 174 |
+
response = tokenizer.decode(
|
| 175 |
+
generated_ids[0],
|
| 176 |
+
skip_special_tokens=True
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
return {
|
| 180 |
+
"common_name": common_name,
|
| 181 |
+
"description": strip_markdown(response),
|
| 182 |
+
}
|
app/models/plant_vision.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/models/plant_vision.py
|
| 2 |
+
|
| 3 |
+
import torch
|
| 4 |
+
from PIL import Image
|
| 5 |
+
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
| 6 |
+
|
| 7 |
+
from app.models.llm import explain_species
|
| 8 |
+
from app.utils.config import DEVICE, PLANT_MODEL_ID
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
processor = AutoImageProcessor.from_pretrained(PLANT_MODEL_ID)
|
| 13 |
+
|
| 14 |
+
model = AutoModelForImageClassification.from_pretrained(
|
| 15 |
+
PLANT_MODEL_ID
|
| 16 |
+
).to(DEVICE)
|
| 17 |
+
|
| 18 |
+
model.eval()
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
@torch.no_grad()
|
| 24 |
+
def predict_plant(image: Image.Image):
|
| 25 |
+
"""
|
| 26 |
+
Returns:
|
| 27 |
+
{
|
| 28 |
+
"species": str,
|
| 29 |
+
"common_name": str | None,
|
| 30 |
+
"confidence": float,
|
| 31 |
+
"description": str
|
| 32 |
+
}
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
inputs = processor(
|
| 36 |
+
images=image,
|
| 37 |
+
return_tensors="pt"
|
| 38 |
+
).to(DEVICE)
|
| 39 |
+
|
| 40 |
+
outputs = model(**inputs)
|
| 41 |
+
|
| 42 |
+
probs = torch.softmax(outputs.logits, dim=-1)
|
| 43 |
+
confidence, idx = probs.max(dim=-1)
|
| 44 |
+
|
| 45 |
+
label = model.config.id2label[idx.item()]
|
| 46 |
+
|
| 47 |
+
llm_result = explain_species(
|
| 48 |
+
species=label,
|
| 49 |
+
confidence=confidence.item(),
|
| 50 |
+
domain="plant"
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
+
return {
|
| 54 |
+
"species": label,
|
| 55 |
+
"common_name": llm_result["common_name"],
|
| 56 |
+
"confidence": confidence.item(),
|
| 57 |
+
"description": llm_result["description"],
|
| 58 |
+
}
|
app/utils/__pycache__/config.cpython-312.pyc
ADDED
|
Binary file (1.09 kB). View file
|
|
|
app/utils/config.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 5 |
+
|
| 6 |
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
| 7 |
+
|
| 8 |
+
FAISS_DIR = BASE_DIR / 'faiss_embedding'
|
| 9 |
+
MODELS_DIR = BASE_DIR / 'models'
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
BIOCLIP_MODEL_ID = 'imageomics/bioclip'
|
| 13 |
+
BIOCLIP_INDEX_PATH = FAISS_DIR / 'bioclip_animal_index.faiss'
|
| 14 |
+
BIOCLIP_EMBEDDINGS_PATH = FAISS_DIR / 'bioclip_animal_embeddings.pt'
|
| 15 |
+
ANIMAL_SPECIES_LIST = FAISS_DIR / 'animal_species_list.txt'
|
| 16 |
+
BIOCLIP_METADATA = FAISS_DIR / 'bioclip_metadata.json'
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
PLANT_MODEL_ID = 'drrobot9/BIONEXUS_PLANT_CLASSIFICATION'
|
| 20 |
+
|
| 21 |
+
QWEN_MODEL_ID = 'Qwen/Qwen2.5-1.5B-Instruct'
|
| 22 |
+
|
| 23 |
+
TOP_K_ANIMALS = 1
|
| 24 |
+
CONFIDENCE_THRESHOLD = 0.25
|
requirements.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
torchvision
|
| 3 |
+
transformers
|
| 4 |
+
accelerate
|
| 5 |
+
safetensors
|
| 6 |
+
|
| 7 |
+
open-clip-torch
|
| 8 |
+
faiss-cpu
|
| 9 |
+
|
| 10 |
+
pillow
|
| 11 |
+
opencv-python-headless
|
| 12 |
+
numpy
|
| 13 |
+
scipy
|
| 14 |
+
scikit-learn
|
| 15 |
+
|
| 16 |
+
fastapi
|
| 17 |
+
uvicorn
|
| 18 |
+
pydantic
|
| 19 |
+
python-multipart
|
| 20 |
+
requests
|
| 21 |
+
tqdm
|