DawnC commited on
Commit
7958b3b
1 Parent(s): 8ada85f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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('/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/(120)best_model/best_model_81_dog.pth', map_location=torch.device('cpu'))
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
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Border_Collie.jpg',
445
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Golden_Retriever.jpeg',
446
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Saint_Bernard.jpeg',
447
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Samoyed.jpg',
448
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/French_Bulldog.jpeg'
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