Shilpaj commited on
Commit
63e2fc6
·
verified ·
1 Parent(s): baf2a78

Fix: Version issue

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -17,8 +17,8 @@ def load_model(model_path: str):
17
  """
18
  Load the model.
19
  """
20
- # Load the pre-trained ResNet50 model from ImageNet
21
- model = models.resnet50(pretrained=False)
22
 
23
  # Load custom weights from a .pth file with CPU mapping
24
  state_dict = torch.load(model_path, map_location=torch.device('cpu'))
@@ -37,7 +37,8 @@ def load_classes():
37
  Load the classes.
38
  """
39
  # Get ImageNet class names from ResNet50 weights
40
- classes = models.ResNet50_Weights.IMAGENET1K_V2.meta["categories"]
 
41
  return classes
42
 
43
 
@@ -112,7 +113,7 @@ def main():
112
  )
113
 
114
  # Launch the demo
115
- demo.launch(server_name="0.0.0.0", debug=True)
116
 
117
 
118
  if __name__ == "__main__":
 
17
  """
18
  Load the model.
19
  """
20
+ # Load the pre-trained ResNet50 model using the new weights parameter
21
+ model = models.resnet50(weights=None)
22
 
23
  # Load custom weights from a .pth file with CPU mapping
24
  state_dict = torch.load(model_path, map_location=torch.device('cpu'))
 
37
  Load the classes.
38
  """
39
  # Get ImageNet class names from ResNet50 weights
40
+ weights = models.ResNet50_Weights.IMAGENET1K_V2
41
+ classes = weights.meta["categories"]
42
  return classes
43
 
44
 
 
113
  )
114
 
115
  # Launch the demo
116
+ demo.launch(server_name="0.0.0.0", debug=True, ssr=False)
117
 
118
 
119
  if __name__ == "__main__":