Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -125,7 +125,7 @@ num_classes = 120
|
|
| 125 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 126 |
model = BaseModel(num_classes=num_classes, device=device)
|
| 127 |
|
| 128 |
-
checkpoint = torch.load('
|
| 129 |
model.load_state_dict(checkpoint['model_state_dict'])
|
| 130 |
|
| 131 |
# evaluation mode
|
|
@@ -441,11 +441,11 @@ def main():
|
|
| 441 |
with gr.Tabs():
|
| 442 |
# 1. 品種檢測標籤頁
|
| 443 |
example_images = [
|
| 444 |
-
'
|
| 445 |
-
'
|
| 446 |
-
'
|
| 447 |
-
'
|
| 448 |
-
'
|
| 449 |
]
|
| 450 |
detection_components = create_detection_tab(predict, example_images)
|
| 451 |
|
|
|
|
| 125 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 126 |
model = BaseModel(num_classes=num_classes, device=device)
|
| 127 |
|
| 128 |
+
checkpoint = torch.load('best_model_81_dog.pth', map_location=torch.device('cpu'))
|
| 129 |
model.load_state_dict(checkpoint['model_state_dict'])
|
| 130 |
|
| 131 |
# evaluation mode
|
|
|
|
| 441 |
with gr.Tabs():
|
| 442 |
# 1. 品種檢測標籤頁
|
| 443 |
example_images = [
|
| 444 |
+
'Border_Collie.jpg',
|
| 445 |
+
'Golden_Retriever.jpeg',
|
| 446 |
+
'Saint_Bernard.jpeg',
|
| 447 |
+
'Samoyed.jpg',
|
| 448 |
+
'French_Bulldog.jpeg'
|
| 449 |
]
|
| 450 |
detection_components = create_detection_tab(predict, example_images)
|
| 451 |
|