Spaces:
Build error
Build error
Update app.py
Browse files
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 #
|
| 64 |
|
| 65 |
model = EfficientNetWithNovelty(num_classes)
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
|