Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,11 +10,11 @@ CLASSES = ['guro', 'pigs', 'proofs', 'protyk', 'safe', 'shit']
|
|
| 10 |
NUM_CLASSES = len(CLASSES)
|
| 11 |
|
| 12 |
#device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 13 |
-
device = 'cpu'
|
| 14 |
|
| 15 |
model = models.resnet18(pretrained=True)
|
| 16 |
model.fc = nn.Linear(model.fc.in_features, NUM_CLASSES)
|
| 17 |
-
model.load_state_dict(torch.load('best_model.pth'))
|
| 18 |
model.to(device)
|
| 19 |
model.eval()
|
| 20 |
|
|
|
|
| 10 |
NUM_CLASSES = len(CLASSES)
|
| 11 |
|
| 12 |
#device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 13 |
+
device = torch.device('cpu')
|
| 14 |
|
| 15 |
model = models.resnet18(pretrained=True)
|
| 16 |
model.fc = nn.Linear(model.fc.in_features, NUM_CLASSES)
|
| 17 |
+
model.load_state_dict(torch.load('best_model.pth', location=device))
|
| 18 |
model.to(device)
|
| 19 |
model.eval()
|
| 20 |
|