Spaces:
Running
Running
Upload 4 files
Browse files- animal_detector.db +0 -0
- app.py +211 -0
- data_manager.py +202 -0
- requirements.txt +6 -0
animal_detector.db
ADDED
Binary file (36.9 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import numpy as np
|
3 |
+
import torch
|
4 |
+
import torch.nn as nn
|
5 |
+
import gradio as gr
|
6 |
+
from torchvision.models import efficientnet_v2_m, EfficientNet_V2_M_Weights
|
7 |
+
import torch.nn.functional as F
|
8 |
+
from torchvision import transforms
|
9 |
+
from PIL import Image
|
10 |
+
#from data_manager import get_dog_description
|
11 |
+
|
12 |
+
dog_breeds = ["Afghan_Hound(阿富汗獵犬)", "African_Hunting_Dog(非洲野犬)", "Airedale(艾爾谷犬)",
|
13 |
+
"American_Staffordshire_Terrier(美國斯塔福郡梗)", "Appenzeller(亞賓澤爾犬)",
|
14 |
+
"Australian_Terrier(澳大利亞梗)", "Bedlington_Terrier(貝德靈頓梗)",
|
15 |
+
"Bernese_Mountain_Dog(伯恩山犬)", "Blenheim_Spaniel(布萊尼姆獵犬)",
|
16 |
+
"Border_Collie(邊境牧羊犬)", "Border_Terrier(邊境梗)", "Boston_Bull(波士頓梗)",
|
17 |
+
"Bouvier_Des_Flandres(法蘭德斯牧羊犬)", "Brabancon_Griffon(布魯塞爾格里芬犬)",
|
18 |
+
"Brittany_Spaniel(布列塔尼獵犬)", "Cardigan(卡迪根威爾士柯基犬)",
|
19 |
+
"Chesapeake_Bay_Retriever(切薩皮克灣獵犬)", "Chihuahua(吉娃娃)",
|
20 |
+
"Dandie_Dinmont(丹第丁蒙梗)", "Doberman(杜賓犬)", "English_Foxhound(英國獵狐犬)",
|
21 |
+
"English_Setter(英國雪達犬)", "English_Springer(英國跳獵犬)",
|
22 |
+
"EntleBucher(恩特雷布赫山地犬)", "Eskimo_Dog(愛斯基摩犬)", "French_Bulldog(法國鬥牛犬)",
|
23 |
+
"German_Shepherd(德國牧羊犬)", "German_Short-Haired_Pointer(德國短毛指示犬)",
|
24 |
+
"Gordon_Setter(戈登雪達犬)", "Great_Dane(大丹犬)", "Great_Pyrenees(大白熊犬)",
|
25 |
+
"Greater_Swiss_Mountain_Dog(大瑞士山地犬)", "Ibizan_Hound(依比沙獵犬)",
|
26 |
+
"Irish_Setter(愛爾蘭雪達犬)", "Irish_Terrier(愛爾蘭梗)",
|
27 |
+
"Irish_Water_Spaniel(愛爾蘭水獵犬)", "Irish_Wolfhound(愛爾蘭獵狼犬)",
|
28 |
+
"Italian_Greyhound(義大利灰狗)", "Japanese_Spaniel(日本狆)",
|
29 |
+
"Kerry_Blue_Terrier(凱利藍梗)", "Labrador_Retriever(拉布拉多尋回犬)",
|
30 |
+
"Lakeland_Terrier(湖畔梗)", "Leonberg(獅毛狗)", "Lhasa(拉薩犬)",
|
31 |
+
"Maltese_Dog(馬爾濟斯犬)", "Mexican_Hairless(墨西哥無毛犬)", "Newfoundland(紐芬蘭犬)",
|
32 |
+
"Norfolk_Terrier(諾福克梗)", "Norwegian_Elkhound(挪威獵麋犬)",
|
33 |
+
"Norwich_Terrier(諾利治梗)", "Old_English_Sheepdog(古代英國牧羊犬)",
|
34 |
+
"Pekinese(北京犬)", "Pembroke(威爾士柯基犬)", "Pomeranian(博美犬)",
|
35 |
+
"Rhodesian_Ridgeback(羅得西亞脊背犬)", "Rottweiler(羅威納犬)",
|
36 |
+
"Saint_Bernard(聖伯納犬)", "Saluki(薩路基獵犬)", "Samoyed(薩摩耶犬)",
|
37 |
+
"Scotch_Terrier(蘇格蘭梗)", "Scottish_Deerhound(蘇格蘭獵鹿犬)",
|
38 |
+
"Sealyham_Terrier(錫利哈姆梗)", "Shetland_Sheepdog(設得蘭牧羊犬)",
|
39 |
+
"Shih-Tzu(西施犬)", "Siberian_Husky(西伯利亞哈士奇)",
|
40 |
+
"Staffordshire_Bullterrier(斯塔福郡鬥牛梗)", "Sussex_Spaniel(蘇塞克斯獵犬)",
|
41 |
+
"Tibetan_Mastiff(藏獒)", "Tibetan_Terrier(西藏梗)", "Walker_Hound(沃克獵犬)",
|
42 |
+
"Weimaraner(威瑪犬)", "Welsh_Springer_Spaniel(威爾士跳獵犬)",
|
43 |
+
"West_Highland_White_Terrier(西高地白梗)", "Yorkshire_Terrier(約克夏梗)",
|
44 |
+
"Affenpinscher(猴犬)", "Basenji(巴辛吉犬)", "Basset(巴吉度獵犬)", "Beagle(比格犬)",
|
45 |
+
"Black-and-Tan_Coonhound(黑褐獵浣熊犬)", "Bloodhound(尋血獵犬)",
|
46 |
+
"Bluetick(布魯提克獵犬)", "Borzoi(俄羅斯獵狼犬)", "Boxer(拳師犬)", "Briard(布里亞犬)",
|
47 |
+
"Bull_Mastiff(獒犬)", "Cairn(凱恩梗)", "Chow(鬆獅犬)", "Clumber(克倫伯獵犬)",
|
48 |
+
"Cocker_Spaniel(可卡獵犬)", "Collie(柯利牧羊犬)", "Curly-Coated_Retriever(捲毛尋回犬)",
|
49 |
+
"Dhole(豺)", "Dingo(澳洲野犬)", "Flat-Coated_Retriever(平毛尋回犬)",
|
50 |
+
"Giant_Schnauzer(大型雪納瑞犬)", "Golden_Retriever(黃金獵犬)",
|
51 |
+
"Groenendael(比利時牧羊犬)", "Keeshond(荷蘭毛獅犬)", "Kelpie(澳洲卡爾比犬)",
|
52 |
+
"Komondor(匈牙利牧羊犬)", "Kuvasz(庫瓦茲犬)", "Malamute(阿拉斯加雪橇犬)",
|
53 |
+
"Malinois(比利時瑪利諾犬)", "Miniature_Pinscher(迷你杜賓犬)",
|
54 |
+
"Miniature_Poodle(迷你貴賓犬)", "Miniature_Schnauzer(迷你雪納瑞犬)",
|
55 |
+
"Otterhound(水獺獵犬)", "Papillon(蝴蝶犬)", "Pug(巴哥犬)", "Redbone(紅骨獵浣熊犬)",
|
56 |
+
"Schipperke(舒柏奇犬)", "Silky_Terrier(絲毛梗)",
|
57 |
+
"Soft-Coated_Wheaten_Terrier(愛爾蘭軟毛梗)", "Standard_Poodle(標準貴賓犬)",
|
58 |
+
"Standard_Schnauzer(標準雪納瑞犬)", "Toy_Poodle(玩具貴賓犬)", "Toy_Terrier(玩具梗)",
|
59 |
+
"Vizsla(維茲拉犬)", "Whippet(惠比特犬)", "Wire-Haired_Fox_Terrier(硬毛獵狐梗)"]
|
60 |
+
|
61 |
+
class MultiHeadAttention(nn.Module):
|
62 |
+
|
63 |
+
def __init__(self, in_dim, num_heads=8):
|
64 |
+
super().__init__()
|
65 |
+
self.num_heads = num_heads
|
66 |
+
self.head_dim = max(1, in_dim // num_heads)
|
67 |
+
self.scaled_dim = self.head_dim * num_heads
|
68 |
+
self.fc_in = nn.Linear(in_dim, self.scaled_dim)
|
69 |
+
self.query = nn.Linear(self.scaled_dim, self.scaled_dim)
|
70 |
+
self.key = nn.Linear(self.scaled_dim, self.scaled_dim)
|
71 |
+
self.value = nn.Linear(self.scaled_dim, self.scaled_dim)
|
72 |
+
self.fc_out = nn.Linear(self.scaled_dim, in_dim)
|
73 |
+
|
74 |
+
def forward(self, x):
|
75 |
+
N = x.shape[0]
|
76 |
+
x = self.fc_in(x)
|
77 |
+
q = self.query(x).view(N, self.num_heads, self.head_dim)
|
78 |
+
k = self.key(x).view(N, self.num_heads, self.head_dim)
|
79 |
+
v = self.value(x).view(N, self.num_heads, self.head_dim)
|
80 |
+
|
81 |
+
energy = torch.einsum("nqd,nkd->nqk", [q, k])
|
82 |
+
attention = F.softmax(energy / (self.head_dim ** 0.5), dim=2)
|
83 |
+
|
84 |
+
out = torch.einsum("nqk,nvd->nqd", [attention, v])
|
85 |
+
out = out.reshape(N, self.scaled_dim)
|
86 |
+
out = self.fc_out(out)
|
87 |
+
return out
|
88 |
+
|
89 |
+
class BaseModel(nn.Module):
|
90 |
+
def __init__(self, num_classes, device='cuda' if torch.cuda.is_available() else 'cpu'):
|
91 |
+
super().__init__()
|
92 |
+
self.device = device
|
93 |
+
self.backbone = efficientnet_v2_m(weights=EfficientNet_V2_M_Weights.IMAGENET1K_V1)
|
94 |
+
self.feature_dim = self.backbone.classifier[1].in_features
|
95 |
+
self.backbone.classifier = nn.Identity()
|
96 |
+
|
97 |
+
# 動態計算 num_heads
|
98 |
+
self.num_heads = max(1, min(8, self.feature_dim // 64))
|
99 |
+
self.attention = MultiHeadAttention(self.feature_dim, num_heads=self.num_heads)
|
100 |
+
|
101 |
+
self.classifier = nn.Sequential(
|
102 |
+
nn.LayerNorm(self.feature_dim),
|
103 |
+
nn.Dropout(0.3),
|
104 |
+
nn.Linear(self.feature_dim, num_classes)
|
105 |
+
)
|
106 |
+
|
107 |
+
self.to(device)
|
108 |
+
|
109 |
+
def forward(self, x):
|
110 |
+
x = x.to(self.device)
|
111 |
+
features = self.backbone(x)
|
112 |
+
attended_features = self.attention(features)
|
113 |
+
logits = self.classifier(attended_features)
|
114 |
+
return logits, attended_features
|
115 |
+
|
116 |
+
|
117 |
+
num_classes = 120
|
118 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
119 |
+
model = BaseModel(num_classes=num_classes, device=device)
|
120 |
+
|
121 |
+
checkpoint = torch.load('/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/best_model/best_model_81_dog.pth', map_location=torch.device('cpu'))
|
122 |
+
model.load_state_dict(checkpoint['model_state_dict'])
|
123 |
+
|
124 |
+
# 將模型設置為評估模式
|
125 |
+
model.eval()
|
126 |
+
|
127 |
+
# Image preprocessing function
|
128 |
+
def preprocess_image(image):
|
129 |
+
# 如果圖片是 numpy.ndarray 轉換為 PIL.Image
|
130 |
+
if isinstance(image, np.ndarray):
|
131 |
+
image = Image.fromarray(image)
|
132 |
+
|
133 |
+
# 使用 torchvision.transforms 進行預處理
|
134 |
+
transform = transforms.Compose([
|
135 |
+
transforms.Resize((224, 224)),
|
136 |
+
transforms.ToTensor(),
|
137 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
|
138 |
+
])
|
139 |
+
|
140 |
+
return transform(image).unsqueeze(0)
|
141 |
+
|
142 |
+
def predict(image):
|
143 |
+
try:
|
144 |
+
image_tensor = preprocess_image(image)
|
145 |
+
with torch.no_grad():
|
146 |
+
logits, _ = model(image_tensor)
|
147 |
+
_, predicted = torch.max(logits, 1)
|
148 |
+
|
149 |
+
breed = dog_breeds[predicted.item()] # Map label to breed name
|
150 |
+
|
151 |
+
# Retrieve breed description
|
152 |
+
description = get_dog_description(breed)
|
153 |
+
|
154 |
+
# Formatting the description for better display
|
155 |
+
if isinstance(description, dict):
|
156 |
+
description_str = f"**Breed**: {description['Breed']}\n\n"
|
157 |
+
description_str += f"**Size**: {description['Size']}\n\n"
|
158 |
+
description_str += f"**Lifespan**: {description['Lifespan']}\n\n"
|
159 |
+
description_str += f"**Temperament**: {description['Temperament']}\n\n"
|
160 |
+
description_str += f"**Care Level**: {description['Care Level']}\n\n"
|
161 |
+
description_str += f"**Good with Children**: {description['Good with Children']}\n\n"
|
162 |
+
description_str += f"**Exercise Needs**: {description['Exercise Needs']}\n\n"
|
163 |
+
description_str += f"**Grooming Needs**: {description['Grooming Needs']}\n\n"
|
164 |
+
description_str += f"**Description**: {description['Description']}\n\n"
|
165 |
+
else:
|
166 |
+
description_str = description
|
167 |
+
|
168 |
+
return description_str
|
169 |
+
except Exception as e:
|
170 |
+
return f"An error occurred: {e}"
|
171 |
+
|
172 |
+
iface = gr.Interface(
|
173 |
+
fn=predict,
|
174 |
+
inputs=gr.Image(label="Upload an image", type="numpy"), # 支持拖放和圖片編輯
|
175 |
+
outputs="markdown",
|
176 |
+
title="<span style='font-family:Roboto; font-weight:bold; color:#2C3E50;'>Dog Breed Classifier</span>",
|
177 |
+
description="<span style='font-family:Open Sans; color:#34495E;'>Upload an image, and the system will predict the breed and provide detailed information from the database.</span>",
|
178 |
+
examples=['/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Border_Collie.jpg',
|
179 |
+
'/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Golden_Retriever.jpeg',
|
180 |
+
'/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Saint_Bernard.jpeg',
|
181 |
+
'/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/French_Bulldog.jpeg',
|
182 |
+
'/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Samoyed.jpg'],
|
183 |
+
css="""
|
184 |
+
.output-markdown {
|
185 |
+
font-family: Noto Sans, sans-serif;
|
186 |
+
line-height: 1.6;
|
187 |
+
}
|
188 |
+
.gr-button {
|
189 |
+
background-color: #3498DB;
|
190 |
+
color: white;
|
191 |
+
border-radius: 8px;
|
192 |
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
|
193 |
+
padding: 10px 20px;
|
194 |
+
}
|
195 |
+
.gr-button:hover {
|
196 |
+
background-color: #2980B9;
|
197 |
+
}
|
198 |
+
.gr-box {
|
199 |
+
background: linear-gradient(to bottom, #f2f4f5, #ffffff);
|
200 |
+
border-radius: 10px;
|
201 |
+
padding: 20px;
|
202 |
+
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
|
203 |
+
}
|
204 |
+
""",
|
205 |
+
theme="default"
|
206 |
+
)
|
207 |
+
|
208 |
+
|
209 |
+
# Launch the app
|
210 |
+
if __name__ == "__main__":
|
211 |
+
iface.launch()
|
data_manager.py
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sqlite3
|
2 |
+
|
3 |
+
def create_table():
|
4 |
+
conn = sqlite3.connect('animal_detector.db')
|
5 |
+
cursor = conn.cursor()
|
6 |
+
|
7 |
+
cursor.execute('''
|
8 |
+
CREATE TABLE IF NOT EXISTS AnimalCatalog (
|
9 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
10 |
+
Species TEXT NOT NULL,
|
11 |
+
Breed TEXT NOT NULL,
|
12 |
+
Size_Category TEXT,
|
13 |
+
Typical_Lifespan TEXT,
|
14 |
+
Temperament TEXT,
|
15 |
+
Care_Level TEXT,
|
16 |
+
Good_With_Children BOOLEAN,
|
17 |
+
Exercise_Needs TEXT,
|
18 |
+
Grooming_Needs TEXT,
|
19 |
+
Brief_Description TEXT
|
20 |
+
)
|
21 |
+
''')
|
22 |
+
|
23 |
+
conn.commit()
|
24 |
+
cursor.close()
|
25 |
+
conn.close()
|
26 |
+
|
27 |
+
# 創建表
|
28 |
+
create_table()
|
29 |
+
|
30 |
+
def insert_dog_data():
|
31 |
+
conn = sqlite3.connect('animal_detector.db')
|
32 |
+
cursor = conn.cursor()
|
33 |
+
|
34 |
+
dog_data = [
|
35 |
+
('Dog', 'Afghan_Hound', 'Large', '12-18 years', 'Independent, dignified, aloof', 'High', True, 'High', 'High', 'Known for their long, silky coat and regal appearance, Afghan Hounds are ancient sighthounds with a unique, elegant presence.'),
|
36 |
+
('Dog', 'African_Hunting_Dog', 'Medium', '10-12 years', 'Social, intelligent, energetic', 'Very High', False, 'Very High', 'Low', 'Also called African Wild Dogs, these are not domestic dogs and are endangered in their native habitats.'),
|
37 |
+
('Dog', 'Airedale', 'Large', '10-12 years', 'Friendly, clever, courageous', 'High', True, 'High', 'High', 'Known as the "King of Terriers," Airedales are the largest of the terrier breeds and very versatile.'),
|
38 |
+
('Dog', 'American_Staffordshire_Terrier', 'Medium', '12-16 years', 'Confident, good-natured, courageous', 'Moderate', True, 'High', 'Low', 'Often confused with Pit Bulls, Am Staffs are strong, muscular dogs with a gentle and loving nature.'),
|
39 |
+
('Dog', 'Appenzeller', 'Medium', '12-15 years', 'Reliable, fearless, lively', 'High', True, 'High', 'Moderate', 'Swiss mountain dogs known for their agility and enthusiasm, Appenzellers make excellent working and family dogs.'),
|
40 |
+
('Dog', 'Australian_Terrier', 'Small', '12-15 years', 'Courageous, spirited, alert', 'Moderate', True, 'Moderate', 'Moderate', 'Small, sturdy terriers originally bred to control rodents, known for their confident personality.'),
|
41 |
+
('Dog', 'Bedlington_Terrier', 'Medium', '11-16 years', 'Mild, gentle, lively', 'High', True, 'Moderate', 'High', 'Known for their lamb-like appearance, Bedlington Terriers are energetic and good with families.'),
|
42 |
+
('Dog', 'Bernese_Mountain_Dog', 'Large', '6-8 years', 'Good-natured, calm, strong', 'High', True, 'Moderate', 'High', 'Large, tri-colored Swiss working dogs known for their gentle nature and striking appearance.'),
|
43 |
+
('Dog', 'Blenheim_Spaniel', 'Small', '12-14 years', 'Affectionate, gentle, lively', 'Moderate', True, 'Moderate', 'High', 'A color variety of the Cavalier King Charles Spaniel, known for their red and white coat and friendly nature.'),
|
44 |
+
('Dog', 'Border_Collie', 'Medium', '12-15 years', 'Intelligent, energetic, alert', 'High', True, 'High', 'Moderate', 'Often considered the most intelligent dog breed, Border Collies are tireless workers and excel in dog sports.'),
|
45 |
+
('Dog', 'Border_Terrier', 'Small', '12-15 years', 'Affectionate, intelligent, even-tempered', 'Moderate', True, 'High', 'Low', 'Small but tough terriers with an otter-like head, known for their friendly and adaptable nature.'),
|
46 |
+
('Dog', 'Boston_Bull', 'Small', '11-13 years', 'Friendly, lively, intelligent', 'Moderate', True, 'Moderate', 'Low', 'Also known as Boston Terriers, these "American Gentlemen" are friendly and adaptable.'),
|
47 |
+
('Dog', 'Bouvier_Des_Flandres', 'Large', '10-12 years', 'Gentle, loyal, rational', 'High', True, 'High', 'High', 'Large, powerful herding dogs with a tousled coat, known for their versatility and even temperament.'),
|
48 |
+
('Dog', 'Brabancon_Griffon', 'Small', '12-15 years', 'Self-important, sensitive, affectionate', 'Moderate', False, 'Moderate', 'Low', 'Also known as the Brussels Griffon, these small dogs have a distinctive beard and mustache, giving them an almost human-like expression.'),
|
49 |
+
('Dog', 'Brittany_Spaniel', 'Medium', '12-14 years', 'Bright, fun-loving, upbeat', 'High', True, 'High', 'Moderate', 'Versatile hunting dogs and active companions, Brittanys are known for their energy and intelligence.'),
|
50 |
+
('Dog', 'Cardigan', 'Small', '12-15 years', 'Affectionate, loyal, intelligent', 'Moderate', True, 'Moderate', 'Moderate', 'Distinguished from Pembroke Welsh Corgis by their long tail, Cardigans are intelligent herding dogs with a fox-like appearance.'),
|
51 |
+
('Dog', 'Chesapeake_Bay_Retriever', 'Large', '10-13 years', 'Bright, sensitive, affectionate', 'High', True, 'High', 'Moderate', 'Known for their waterproof coat, Chessies are strong swimmers and excellent retrievers.'),
|
52 |
+
('Dog', 'Chihuahua', 'Small', '12-20 years', 'Charming, graceful, sassy', 'Moderate', False, 'Low', 'Low', 'One of the smallest dog breeds, known for their big personalities and loyalty to their owners.'),
|
53 |
+
('Dog', 'Dandie_Dinmont', 'Small', '12-15 years', 'Independent, intelligent, dignified', 'Moderate', True, 'Moderate', 'Moderate', 'Recognizable by their long body and distinctive "topknot" of hair on their head.'),
|
54 |
+
('Dog', 'Doberman', 'Large', '10-12 years', 'Loyal, fearless, alert', 'High', True, 'High', 'Low', 'Sleek, athletic dogs known for their intelligence and loyalty, often used as guard dogs.'),
|
55 |
+
('Dog', 'English_Foxhound', 'Medium', '10-13 years', 'Friendly, active, gentle', 'High', True, 'Very High', 'Low', 'Athletic, pack-oriented hounds originally bred for fox hunting in England.'),
|
56 |
+
('Dog', 'English_Setter', 'Large', '10-12 years', 'Gentle, friendly, placid', 'High', True, 'High', 'High', 'Known for their speckled coat or "belton" markings, English Setters are elegant bird dogs and affectionate companions.'),
|
57 |
+
('Dog', 'English_Springer', 'Medium', '12-14 years', 'Friendly, playful, obedient', 'High', True, 'High', 'High', 'Energetic and eager to please, Springers are excellent hunting dogs and loving family pets.'),
|
58 |
+
('Dog', 'EntleBucher', 'Medium', '11-13 years', 'Loyal, enthusiastic, intelligent', 'High', True, 'High', 'Low', 'The smallest of the Swiss Mountain Dogs, known for their agility and herding abilities.'),
|
59 |
+
('Dog', 'Eskimo_Dog', 'Large', '10-15 years', 'Alert, loyal, intelligent', 'High', True, 'High', 'High', 'Also known as the Canadian Eskimo Dog, these are strong, resilient working dogs adapted to Arctic conditions.'),
|
60 |
+
('Dog', 'French_Bulldog', 'Small', '10-12 years', 'Playful, adaptable, smart', 'Moderate', True, 'Low', 'Low', 'French Bulldogs are small, muscular dogs with a smooth coat, short face, and bat-like ears. They are affectionate, playful, and well-suited for family living.'),
|
61 |
+
('Dog', 'German_Shepherd', 'Large', '10-13 years', 'Confident, courageous, smart', 'High', True, 'High', 'Moderate', 'Versatile working dogs, German Shepherds excel in various roles from police work to family protection.'),
|
62 |
+
('Dog', 'German_Short-Haired_Pointer', 'Large', '10-12 years', 'Friendly, intelligent, willing to please', 'High', True, 'Very High', 'Moderate', 'Versatile hunting dogs known for their pointer stance, these dogs excel in both water and land retrieving.'),
|
63 |
+
('Dog', 'Gordon_Setter', 'Large', '10-12 years', 'Confident, fearless, alert', 'High', True, 'High', 'High', 'The largest of the setter breeds, Gordon Setters are known for their black and tan coloring and loyal nature.'),
|
64 |
+
('Dog', 'Great_Dane', 'Giant', '7-10 years', 'Friendly, patient, dependable', 'High', True, 'Moderate', 'Low', 'One of the largest dog breeds, Great Danes are known as gentle giants with a friendly disposition.'),
|
65 |
+
('Dog', 'Great_Pyrenees', 'Large', '10-12 years', 'Patient, calm, gentle', 'High', True, 'Moderate', 'High', 'Large, powerful dogs originally bred to guard livestock, known for their gentle and protective nature.'),
|
66 |
+
('Dog', 'Greater_Swiss_Mountain_dog', 'Large', '8-11 years', 'Faithful, alert, vigilant', 'Moderate', True, 'Moderate', 'Low', 'Large, strong working dogs with a tricolor coat, Swissies are gentle giants with a calm temperament.'),
|
67 |
+
('Dog', 'Ibizan_Hound', 'Medium', '12-14 years', 'Even-tempered, loyal, independent', 'Moderate', True, 'High', 'Low', 'Sleek, athletic sighthounds known for their large, erect ears and red and white coats.'),
|
68 |
+
('Dog', 'Irish_Setter', 'Large', '11-15 years', 'Outgoing, sweet-tempered, active', 'High', True, 'High', 'High', 'Recognizable by their rich red coat, Irish Setters are energetic and playful dogs that love family life.'),
|
69 |
+
('Dog', 'Irish_Terrier', 'Medium', '12-16 years', 'Bold, daring, intelligent', 'Moderate', True, 'High', 'Moderate', 'Known as the "Daredevil," Irish Terriers are courageous and loyal with a distinctive red coat.'),
|
70 |
+
('Dog', 'Irish_Water_spaniel', 'Large', '10-12 years', 'Playful, brave, intelligent', 'High', True, 'High', 'High', 'Largest of the spaniels, known for their curly, liver-colored coat and rat-like tail.'),
|
71 |
+
('Dog', 'Irish_Wolfhound', 'Giant', '6-8 years', 'Gentle, patient, dignified', 'High', True, 'Moderate', 'Moderate', 'The tallest of all dog breeds, Irish Wolfhounds are gentle giants known for their calm and friendly nature.'),
|
72 |
+
('Dog', 'Italian_Greyhound', 'Small', '12-15 years', 'Sensitive, alert, playful', 'Moderate', False, 'Moderate', 'Low', 'Miniature sighthounds known for their elegant appearance and affectionate nature, Italian Greyhounds make excellent companion dogs.'),
|
73 |
+
('Dog', 'Japanese_Spaniel', 'Small', '10-12 years', 'Charming, noble, affectionate', 'Moderate', False, 'Low', 'High', 'Also known as the Japanese Chin, these small companion dogs have a distinctive flat face and were once favorites of Japanese nobility.'),
|
74 |
+
('Dog', 'Kerry_Blue_Terrier', 'Medium', '12-15 years', 'Alert, adaptable, people-oriented', 'High', True, 'High', 'High', 'Medium-sized terriers with a distinctive blue coat, known for their versatility and intelligence.'),
|
75 |
+
('Dog', 'Labrador_Retriever', 'Large', '10-12 years', 'Friendly, outgoing, even-tempered', 'Moderate', True, 'High', 'Moderate', 'One of the most popular dog breeds, known for their friendly nature and excellent retrieving skills.'),
|
76 |
+
('Dog', 'Lakeland_Terrier', 'Small', '12-16 years', 'Bold, friendly, confident', 'Moderate', True, 'High', 'High', 'Named after the Lake District in England, these terriers are sturdy and bold with a wiry coat.'),
|
77 |
+
('Dog', 'Leonberg', 'Giant', '7-9 years', 'Gentle, friendly, intelligent', 'High', True, 'Moderate', 'High', 'Large, muscular dogs with a lion-like mane, known for their gentle nature and water rescue abilities.'),
|
78 |
+
('Dog', 'Lhasa', 'Small', '12-15 years', 'Confident, smart, comical', 'High', False, 'Low', 'High', 'Lhasa Apsos are small but sturdy dogs with a long, flowing coat. They were originally bred as indoor sentinel dogs in Buddhist monasteries.'),
|
79 |
+
('Dog', 'Maltese_Dog', 'Small', '12-15 years', 'Gentle, playful, charming', 'High', False, 'Low', 'High', 'Small, elegant dogs with long, silky white coats, known for their sweet and affectionate nature.'),
|
80 |
+
('Dog', 'Mexican_Hairless', 'Varies', '12-15 years', 'Loyal, alert, cheerful', 'Moderate', True, 'Moderate', 'Low', 'Also known as the Xoloitzcuintli, these dogs come in three sizes and can be either hairless or coated, known for their ancient history in Mexico.'),
|
81 |
+
('Dog', 'Newfoundland', 'Giant', '8-10 years', 'Sweet, patient, devoted', 'High', True, 'Moderate', 'High', 'Large, strong dogs known for their water rescue abilities and gentle nature, especially with children.'),
|
82 |
+
('Dog', 'Norfolk_Terrier', 'Small', '12-15 years', 'Fearless, spirited, companionable', 'Moderate', True, 'Moderate', 'Moderate', 'Small, sturdy terriers with a wiry coat, known for their playful and affectionate nature.'),
|
83 |
+
('Dog', 'Norwegian_Elkhound', 'Medium', '12-15 years', 'Bold, playful, loyal', 'High', True, 'High', 'High', 'Ancient Nordic breed known for their silver-gray coat and curled tail, originally used for hunting moose and other large game.'),
|
84 |
+
('Dog', 'Norwich_Terrier', 'Small', '12-15 years', 'Fearless, loyal, affectionate', 'Moderate', True, 'Moderate', 'Moderate', 'One of the smallest terriers, Norwich Terriers are hardy, fearless, and affectionate companions.'),
|
85 |
+
('Dog', 'Old_English_Sheepdog', 'Large', '10-12 years', 'Adaptable, gentle, intelligent', 'High', True, 'Moderate', 'High', 'Recognizable by their shaggy coat, Old English Sheepdogs are adaptable and good-natured.'),
|
86 |
+
('Dog', 'Pekinese', 'Small', '12-14 years', 'Affectionate, loyal, regal in manner', 'Moderate', False, 'Low', 'High', 'Also spelled Pekingese, these small dogs with flat faces and long coats were once sacred to Chinese royalty.'),
|
87 |
+
('Dog', 'Pembroke', 'Small', '12-15 years', 'Affectionate, intelligent, outgoing', 'Moderate', True, 'Moderate', 'Moderate', 'Known for their short legs and long bodies, Pembroke Welsh Corgis are herding dogs favored by the British royal family.'),
|
88 |
+
('Dog', 'Pomeranian', 'Small', '12-16 years', 'Lively, bold, inquisitive', 'Moderate', False, 'Low', 'High', 'Small, fluffy dogs with fox-like faces, known for their vivacious personalities and luxurious coats.'),
|
89 |
+
('Dog', 'Rhodesian_Ridgeback', 'Large', '10-12 years', 'Dignified, intelligent, strong-willed', 'Moderate', True, 'High', 'Low', 'Large, muscular dogs known for the ridge of hair along their backs, originally bred to hunt lions in Africa.'),
|
90 |
+
('Dog', 'Rottweiler', 'Large', '8-10 years', 'Loyal, loving, confident guardian', 'High', True, 'High', 'Low', 'Powerful and protective, Rottweilers are excellent guard dogs but also loving family companions when well-trained.'),
|
91 |
+
('Dog', 'Saint_Bernard', 'Giant', '8-10 years', 'Gentle, patient, friendly', 'High', True, 'Moderate', 'High', 'Known for their massive size and gentle nature, Saint Bernards were originally bred for rescue work in the Swiss Alps.'),
|
92 |
+
('Dog', 'Saluki', 'Large', '12-14 years', 'Gentle, dignified, independent-minded', 'High', True, 'High', 'Low', 'Ancient sighthounds known for their grace and speed, Salukis have a distinctive feathered coat and ears.'),
|
93 |
+
('Dog', 'Samoyed', 'Medium', '12-14 years', 'Friendly, gentle, adaptable', 'High', True, 'High', 'High', 'Beautiful white Arctic dogs known for their "smiling" expression and thick, fluffy coat.'),
|
94 |
+
('Dog', 'Scotch_Terrier', 'Small', '11-13 years', 'Independent, confident, spirited', 'Moderate', True, 'Moderate', 'High', 'Also known as the Scottish Terrier, these distinctive dogs with beards and eyebrows are known for their dignified, almost human-like personality.'),
|
95 |
+
('Dog', 'Scottish_Deerhound', 'Large', '8-11 years', 'Gentle, dignified, polite', 'High', True, 'High', 'Moderate', 'Large, wiry-coated sighthounds resembling Greyhounds, known for their gentle nature and hunting ability.'),
|
96 |
+
('Dog', 'Sealyham_Terrier', 'Small', '12-14 years', 'Alert, outgoing, calm', 'Moderate', True, 'Moderate', 'High', 'Originally bred for hunting, Sealyhams are now rare but make charming and sturdy companions.'),
|
97 |
+
('Dog', 'Shetland_Sheepdog', 'Small', '12-14 years', 'Playful, energetic, intelligent', 'High', True, 'High', 'High', 'Small herding dogs resembling miniature Collies, known for their intelligence and agility.'),
|
98 |
+
('Dog', 'Shih-Tzu', 'Small', '10-16 years', 'Affectionate, playful, outgoing', 'High', True, 'Low', 'High', 'Small, affectionate companion dogs known for their long, silky coat and sweet personality.'),
|
99 |
+
('Dog', 'Siberian_Husky', 'Medium', '12-14 years', 'Outgoing, mischievous, loyal', 'High', True, 'Very High', 'Moderate', 'Beautiful sled dogs known for their striking blue eyes, thick coats, and wolf-like appearance.'),
|
100 |
+
('Dog', 'Staffordshire_Bullterrier', 'Medium', '12-14 years', 'Courageous, intelligent, loyal', 'Moderate', True, 'High', 'Low', 'Strong, muscular terriers known for their courage and affectionate nature, especially with children.'),
|
101 |
+
('Dog', 'Sussex_Spaniel', 'Medium', '11-13 years', 'Calm, friendly, merry', 'Moderate', True, 'Moderate', 'Moderate', 'Rare breed of spaniel known for their golden-liver coat and low-set body, originally bred for hunting.'),
|
102 |
+
('Dog', 'Tibetan_Mastiff', 'Large', '10-12 years', 'Independent, reserved, intelligent', 'High', False, 'Moderate', 'High', 'Ancient guardian breed known for their massive size and thick coat, Tibetan Mastiffs are independent and protective.'),
|
103 |
+
('Dog', 'Tibetan_Terrier', 'Medium', '12-15 years', 'Affectionate, sensitive, clever', 'High', True, 'Moderate', 'High', 'Not actually terriers, these dogs were bred in Tibet and are known for their profuse, long coat.'),
|
104 |
+
('Dog', 'Walker_Hound', 'Large', '12-13 years', 'Smart, brave, friendly', 'Moderate', True, 'High', 'Low', 'Also known as the Treeing Walker Coonhound, these dogs are excellent hunters with a distinctive bark.'),
|
105 |
+
('Dog', 'Weimaraner', 'Large', '10-13 years', 'Friendly, fearless, obedient', 'High', True, 'High', 'Low', 'Known as the "Gray Ghost," Weimaraners are athletic and intelligent dogs with a distinctive silver-gray coat.'),
|
106 |
+
('Dog', 'Welsh_Springer_Spaniel', 'Medium', '12-15 years', 'Active, loyal, affectionate', 'High', True, 'High', 'Moderate', 'Similar to English Springers but with a distinctive red and white coat, Welsh Springers are devoted and energetic.'),
|
107 |
+
('Dog', 'West_Highland_White_Terrier', 'Small', '12-16 years', 'Friendly, hardy, confident', 'Moderate', True, 'Moderate', 'High', 'Commonly known as "Westies," these white terriers are friendly and sturdy with a bright personality.'),
|
108 |
+
('Dog', 'Yorkshire_Terrier', 'Small', '13-16 years', 'Affectionate, sprightly, tomboyish', 'High', False, 'Moderate', 'High', 'Popular toy breed known for their long silky coat and feisty personality.'),
|
109 |
+
('Dog', 'Affenpinscher', 'Small', '12-15 years', 'Confident, amusing, stubborn', 'Moderate', False, 'Moderate', 'Moderate', 'Small terrier-like toys known as "monkey dogs" due to their distinctive facial appearance.'),
|
110 |
+
('Dog', 'Basenji', 'Small', '12-16 years', 'Independent, smart, poised', 'Moderate', False, 'High', 'Low', 'Ancient African breed known for their inability to bark, instead making a unique yodel-like sound.'),
|
111 |
+
('Dog', 'Basset', 'Medium', '10-12 years', 'Patient, low-key, charming', 'Moderate', True, 'Low', 'Moderate', 'Short-legged, long-bodied hounds known for their excellent sense of smell and gentle dispositions.'),
|
112 |
+
('Dog', 'Beagle', 'Small', '12-15 years', 'Merry, friendly, curious', 'Moderate', True, 'High', 'Low', 'Small hound dogs known for their excellent sense of smell and friendly, outgoing personalities.'),
|
113 |
+
('Dog', 'Black-and-tan_Coonhound', 'Large', '10-12 years', 'Even-tempered, easygoing, friendly', 'Moderate', True, 'High', 'Low', 'Large, powerful scent hounds known for their distinctive black and tan coloration and melodious bay.'),
|
114 |
+
('Dog', 'Bloodhound', 'Large', '10-12 years', 'Gentle, patient, stubborn', 'High', True, 'Moderate', 'Moderate', 'Known for their exceptional sense of smell, Bloodhounds are large, gentle dogs often used in tracking.'),
|
115 |
+
('Dog', 'Bluetick', 'Large', '11-12 years', 'Friendly, intelligent, active', 'Moderate', True, 'High', 'Low', 'Known for their mottled blue coat, Bluetick Coonhounds are skilled hunting dogs with a keen sense of smell and a melodious howl.'),
|
116 |
+
('Dog', 'Borzoi', 'Large', '10-12 years', 'Quiet, gentle, athletic', 'High', True, 'Moderate', 'High', 'Also known as Russian Wolfhounds, Borzois are elegant sighthounds known for their silky coat and graceful demeanor.'),
|
117 |
+
('Dog', 'Boxer', 'Large', '10-12 years', 'Fun-loving, bright, active', 'Moderate', True, 'High', 'Low', 'Playful and energetic, Boxers are known for their patient and protective nature with children.'),
|
118 |
+
('Dog', 'Briard', 'Large', '10-12 years', 'Confident, smart, loyal', 'High', True, 'High', 'High', 'Large French herding dogs with a distinctive long, wavy coat, Briards are loyal and protective.'),
|
119 |
+
('Dog', 'Bull_mastiff', 'Large', '8-10 years', 'Affectionate, loyal, quiet', 'Moderate', True, 'Moderate', 'Low', 'Large, powerful dogs originally bred to guard estates, Bullmastiffs are gentle giants with a calm demeanor.'),
|
120 |
+
('Dog', 'Cairn', 'Small', '13-15 years', 'Alert, cheerful, busy', 'Moderate', True, 'Moderate', 'Moderate', 'Small, rugged terriers known for their shaggy coat and lively personality.'),
|
121 |
+
('Dog', 'Chow', 'Medium', '8-12 years', 'Aloof, loyal, quiet', 'High', False, 'Low', 'High', 'Ancient Chinese breed known for their lion-like mane and blue-black tongues.'),
|
122 |
+
('Dog', 'Clumber', 'Large', '10-12 years', 'Gentle, loyal, thoughtful', 'Moderate', True, 'Moderate', 'High', 'The largest of the spaniels, Clumbers are known for their distinctive white coat and calm demeanor.'),
|
123 |
+
('Dog', 'Cocker_spaniel', 'Small', '10-14 years', 'Gentle, smart, happy', 'High', True, 'Moderate', 'High', 'Known for their long, silky ears and expressive eyes, Cockers are popular family dogs with a merry disposition.'),
|
124 |
+
('Dog', 'Collie', 'Large', '10-14 years', 'Devoted, graceful, proud', 'High', True, 'High', 'High', 'Made famous by "Lassie," Collies are intelligent herding dogs known for their loyalty and grace.'),
|
125 |
+
('Dog', 'Curly-coated_retriever', 'Large', '10-12 years', 'Confident, independent, intelligent', 'Moderate', True, 'High', 'Low', 'Sporting dogs with a distinctive curly coat, known for their excellent swimming and retrieving abilities.'),
|
126 |
+
('Dog', 'Dhole', 'Medium', '10-13 years', 'Social, intelligent, athletic', 'High', False, 'High', 'Low', 'Also known as the Asiatic wild dog, Dholes are not typically kept as pets but are important in Asian ecosystems.'),
|
127 |
+
('Dog', 'Dingo', 'Medium', '10-13 years', 'Independent, intelligent, alert', 'High', False, 'High', 'Low', 'Native wild dogs of Australia, dingoes are not typically kept as pets and are important to the Australian ecosystem.'),
|
128 |
+
('Dog', 'Flat-Coated_Retriever', 'Large', '8-10 years', 'Optimistic, good-humored, outgoing', 'High', True, 'Very High', 'Moderate', 'Known for their shiny black or liver-colored coat, Flat-coated Retrievers are energetic and playful, excelling in both hunting and family life.'),
|
129 |
+
('Dog', 'Giant_Schnauzer', 'Large', '10-12 years', 'Loyal, intelligent, powerful', 'High', True, 'High', 'High', 'Large and powerful, Giant Schnauzers were originally bred as working dogs and require plenty of exercise.'),
|
130 |
+
('Dog', 'Golden_Retriever', 'Large', '10-12 years', 'Intelligent, friendly, devoted', 'High', True, 'High', 'High', 'Beautiful, golden-coated dogs known for their gentle nature and excellence in various roles.'),
|
131 |
+
('Dog', 'Groenendael', 'Large', '10-12 years', 'Intelligent, protective, loyal', 'High', True, 'High', 'High', 'The black variety of Belgian Shepherd, Groenendaels are intelligent working dogs with a long, black coat.'),
|
132 |
+
('Dog', 'Keeshond', 'Medium', '12-15 years', 'Friendly, lively, outgoing', 'Moderate', True, 'Moderate', 'High', 'Distinctive "spectacles" marking around their eyes, Keeshonds are fluffy, fox-like dogs known for their friendly and affectionate nature.'),
|
133 |
+
('Dog', 'Kelpie', 'Medium', '10-13 years', 'Intelligent, energetic, loyal', 'High', True, 'Very High', 'Low', 'Australian herding dogs known for their incredible work ethic and agility.'),
|
134 |
+
('Dog', 'Komondor', 'Large', '10-12 years', 'Steady, fearless, affectionate', 'High', True, 'Moderate', 'High', 'Large Hungarian sheepdogs known for their distinctive corded white coat, resembling dreadlocks.'),
|
135 |
+
('Dog', 'Kuvasz', 'Large', '10-12 years', 'Protective, loyal, patient', 'High', True, 'Moderate', 'High', 'Large, white guardian dogs from Hungary, Kuvaszok are protective of their families and independent.'),
|
136 |
+
('Dog', 'Malamute', 'Large', '10-12 years', 'Affectionate, loyal, playful', 'High', True, 'Very High', 'High', 'Large, powerful sled dogs with thick coats, known for their strength and endurance.'),
|
137 |
+
('Dog', 'Malinois', 'Medium', '12-14 years', 'Confident, smart, hardworking', 'High', True, 'High', 'Moderate', 'One of four varieties of Belgian Shepherd, known for their intelligence and use in police and military work.'),
|
138 |
+
('Dog', 'Miniature_Pinscher', 'Small', '12-16 years', 'Fearless, energetic, alert', 'Moderate', False, 'Moderate', 'Low', 'Often called "King of Toys," Min Pins are small, energetic dogs with a big personality.'),
|
139 |
+
('Dog', 'Miniature_Poodle', 'Small', '12-15 years', 'Intelligent, active, alert', 'High', True, 'Moderate', 'High', 'Smaller version of the Standard Poodle, known for their intelligence and hypoallergenic coat.'),
|
140 |
+
('Dog', 'Miniature_Schnauzer', 'Small', '12-15 years', 'Friendly, smart, obedient', 'Moderate', True, 'Moderate', 'High', 'The smallest of the Schnauzer breeds, known for their distinctive beard and eyebrows.'),
|
141 |
+
('Dog', 'Otterhound', 'Large', '10-13 years', 'Friendly, boisterous, even-tempered', 'High', True, 'High', 'High', 'Large, shaggy-coated hounds originally bred for hunting otters, now a rare breed.'),
|
142 |
+
('Dog', 'Papillon', 'Small', '13-15 years', 'Happy, alert, friendly', 'Moderate', True, 'Moderate', 'Moderate', 'Small, elegant dogs known for their butterfly-like ears and lively personalities.'),
|
143 |
+
('Dog', 'Pug', 'Small', '12-15 years', 'Charming, mischievous, loving', 'Moderate', True, 'Low', 'Moderate', 'Small, wrinkly-faced dogs known for their charming personality and comical expression.'),
|
144 |
+
('Dog', 'Redbone', 'Large', '10-12 years', 'Even-tempered, amiable, eager to please', 'Moderate', True, 'High', 'Low', 'Known for their solid red coat, Redbone Coonhounds are athletic, warm-hearted dogs originally bred for hunting.'),
|
145 |
+
('Dog', 'Schipperke', 'Small', '13-15 years', 'Confident, alert, curious', 'Moderate', True, 'Moderate', 'Moderate', 'Small, black dogs with a fox-like face, Schipperkes are known for their distinctive ruff and small, pointed ears.'),
|
146 |
+
('Dog', 'Silky_terrier', 'Small', '12-15 years', 'Friendly, quick, alert', 'Moderate', False, 'Moderate', 'High', 'Similar to Yorkshire Terriers but larger, Silky Terriers are playful and enjoy being part of family activities.'),
|
147 |
+
('Dog', 'Soft-Coated_Wheaten_Terrier', 'Medium', '12-14 years', 'Happy, steady, self-confident', 'High', True, 'High', 'High', 'Known for their soft, wheat-colored coat and friendly demeanor, they make great family dogs.'),
|
148 |
+
('Dog', 'Standard_Poodle', 'Large', '10-18 years', 'Intelligent, active, dignified', 'High', True, 'High', 'High', 'Highly intelligent and elegant dogs, known for their hypoallergenic coat and versatility in various dog sports.'),
|
149 |
+
('Dog', 'Standard_Schnauzer', 'Medium', '13-16 years', 'Friendly, intelligent, obedient', 'High', True, 'High', 'High', 'The original Schnauzer breed, known for their distinctive beard and eyebrows and versatile working abilities.'),
|
150 |
+
('Dog', 'Toy_Poodle', 'Small', '12-18 years', 'Intelligent, lively, playful', 'High', True, 'Moderate', 'High', 'The smallest variety of Poodle, known for their intelligence, agility, and hypoallergenic coat.'),
|
151 |
+
('Dog', 'Toy_Terrier', 'Small', '12-16 years', 'Lively, bold, intelligent', 'Moderate', False, 'Moderate', 'Low', 'A general term for small terrier breeds, often referring to breeds like the English Toy Terrier or Toy Fox Terrier.'),
|
152 |
+
('Dog', 'Vizsla', 'Medium', '10-14 years', 'Affectionate, energetic, gentle', 'High', True, 'High', 'Low', 'Known for their golden-rust coat, Vizslas are versatile hunters and loving family companions.'),
|
153 |
+
('Dog', 'Whippet', 'Medium', '12-15 years', 'Gentle, affectionate, quiet', 'Low', True, 'High', 'Low', 'Slender, athletic sighthounds known for their speed and gentle nature.'),
|
154 |
+
('Dog', 'Wire-Haired_Fox_Terrier', 'Small', '12-15 years', 'Alert, confident, gregarious', 'High', True, 'High', 'High', 'Energetic and wire-coated, these terriers were originally bred for fox hunting.') ]
|
155 |
+
|
156 |
+
cursor.executemany('''
|
157 |
+
INSERT INTO AnimalCatalog (Species, Breed, Size_Category, Typical_Lifespan, Temperament, Care_Level, Good_With_Children, Exercise_Needs, Grooming_Needs, Brief_Description)
|
158 |
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
159 |
+
''', dog_data)
|
160 |
+
|
161 |
+
conn.commit()
|
162 |
+
cursor.close()
|
163 |
+
conn.close()
|
164 |
+
|
165 |
+
def get_dog_description(breed):
|
166 |
+
try:
|
167 |
+
# 連接到 SQLite 資料庫
|
168 |
+
conn = sqlite3.connect('animal_detector.db')
|
169 |
+
cursor = conn.cursor()
|
170 |
+
|
171 |
+
# 去掉 breed 的中文括號部分,保持一致性
|
172 |
+
breed_name = breed.split('(')[0]
|
173 |
+
|
174 |
+
# SQL 查詢語句,根據品種名稱查詢資料
|
175 |
+
cursor.execute("SELECT * FROM AnimalCatalog WHERE Breed = ?", (breed_name,))
|
176 |
+
result = cursor.fetchone()
|
177 |
+
|
178 |
+
# 關閉資料庫連接
|
179 |
+
cursor.close()
|
180 |
+
conn.close()
|
181 |
+
|
182 |
+
# 如果找到資料,返回字典格式的描述信息
|
183 |
+
if result:
|
184 |
+
description = {
|
185 |
+
"Breed": result[2],
|
186 |
+
"Size": result[3],
|
187 |
+
"Lifespan": result[4],
|
188 |
+
"Temperament": result[5],
|
189 |
+
"Care Level": result[6],
|
190 |
+
"Good with Children": "Yes" if result[7] else "No",
|
191 |
+
"Exercise Needs": result[8],
|
192 |
+
"Grooming Needs": result[9],
|
193 |
+
"Description": result[10]
|
194 |
+
}
|
195 |
+
return description
|
196 |
+
else:
|
197 |
+
return "Description not available for this breed."
|
198 |
+
|
199 |
+
except Exception as e:
|
200 |
+
return f"An error occurred: {e}"
|
201 |
+
|
202 |
+
insert_dog_data()
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
torch==2.4.1+cu121
|
3 |
+
torchvision==0.19.1+cu121
|
4 |
+
gradio==5.0.2
|
5 |
+
Pillow==10.4.0
|
6 |
+
sqlite3
|