DawnC commited on
Commit
8adad4b
1 Parent(s): ccacb4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
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('/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/(120)best_model/best_model_81_dog.pth', map_location=torch.device('cpu'))
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=['/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Border_Collie.jpg',
775
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/test_images/Golden_Retriever.jpeg',
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"):