DawnC commited on
Commit
979a7b6
1 Parent(s): 4fd933f

Update app.py

Browse files

remove drive path

Files changed (1) hide show
  1. app.py +6 -6
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('/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/best_model/best_model_81_dog.pth', map_location=torch.device('cpu'))
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=['/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Border_Collie.jpg',
179
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Golden_Retriever.jpeg',
180
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Saint_Bernard.jpeg',
181
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/French_Bulldog.jpeg',
182
- '/content/drive/Othercomputers/我的 MacBook Pro/Learning/Cats_Dogs_Detector/Samoyed.jpg'],
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;