MoinulwithAI commited on
Commit
670c205
·
verified ·
1 Parent(s): 28220cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -60,10 +60,13 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
60
 
61
  # Update this path with your model path
62
  model_path = 'best_model.pth'
63
- num_classes = 10 # Assuming you have 10 classes, update based on your dataset
64
 
65
  model = EfficientNetWithNovelty(num_classes)
66
- model.load_state_dict(torch.load(model_path, map_location=device))
 
 
 
67
  model.to(device)
68
  model.eval()
69
 
 
60
 
61
  # Update this path with your model path
62
  model_path = 'best_model.pth'
63
+ num_classes = 10 # Update based on your dataset
64
 
65
  model = EfficientNetWithNovelty(num_classes)
66
+
67
+ # Load checkpoint instead of raw state_dict
68
+ checkpoint = torch.load(model_path, map_location=device)
69
+ model.load_state_dict(checkpoint["model_state_dict"]) # Correct key for model weights
70
  model.to(device)
71
  model.eval()
72