Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -108,7 +108,7 @@ num_classes = 120
|
|
108 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
109 |
model = BaseModel(num_classes=num_classes, device=device)
|
110 |
|
111 |
-
checkpoint = torch.load('
|
112 |
model.load_state_dict(checkpoint['model_state_dict'])
|
113 |
|
114 |
# evaluation mode
|
@@ -771,13 +771,8 @@ with gr.Blocks(css=get_css_styles()) as iface:
|
|
771 |
)
|
772 |
|
773 |
gr.Examples(
|
774 |
-
examples=['
|
775 |
-
|
776 |
-
'/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Saint_Bernard.jpeg',
|
777 |
-
'/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Samoyed.jpg',
|
778 |
-
'/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/French_Bulldog.jpeg'],
|
779 |
-
inputs=input_image
|
780 |
-
)
|
781 |
|
782 |
# 第二個 Tab:品種比較功能
|
783 |
with gr.TabItem("Breed Comparison"):
|
|
|
108 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
109 |
model = BaseModel(num_classes=num_classes, device=device)
|
110 |
|
111 |
+
checkpoint = torch.load('best_model_81_dog.pth', map_location=torch.device('cpu'))
|
112 |
model.load_state_dict(checkpoint['model_state_dict'])
|
113 |
|
114 |
# evaluation mode
|
|
|
771 |
)
|
772 |
|
773 |
gr.Examples(
|
774 |
+
examples=['Border_Collie.jpg', 'Golden_Retriever.jpeg', 'Saint_Bernard.jpeg', 'Samoyed.jpg', 'French_Bulldog.jpeg'],
|
775 |
+
inputs=input_image)
|
|
|
|
|
|
|
|
|
|
|
776 |
|
777 |
# 第二個 Tab:品種比較功能
|
778 |
with gr.TabItem("Breed Comparison"):
|