Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse filesremove drive path
app.py
CHANGED
@@ -118,7 +118,7 @@ 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('
|
122 |
model.load_state_dict(checkpoint['model_state_dict'])
|
123 |
|
124 |
# 將模型設置為評估模式
|
@@ -175,11 +175,11 @@ iface = gr.Interface(
|
|
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=['
|
179 |
-
'
|
180 |
-
'
|
181 |
-
'
|
182 |
-
'
|
183 |
css="""
|
184 |
.output-markdown {
|
185 |
font-family: Noto Sans, sans-serif;
|
|
|
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('best_model_81_dog.pth', map_location=torch.device('cpu'))
|
122 |
model.load_state_dict(checkpoint['model_state_dict'])
|
123 |
|
124 |
# 將模型設置為評估模式
|
|
|
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=['Border_Collie.jpg',
|
179 |
+
'Golden_Retriever.jpeg',
|
180 |
+
'Saint_Bernard.jpeg',
|
181 |
+
'French_Bulldog.jpeg',
|
182 |
+
'Samoyed.jpg'],
|
183 |
css="""
|
184 |
.output-markdown {
|
185 |
font-family: Noto Sans, sans-serif;
|