gpu to cpu
Browse files
utils/__pycache__/model.cpython-310.pyc
CHANGED
Binary files a/utils/__pycache__/model.cpython-310.pyc and b/utils/__pycache__/model.cpython-310.pyc differ
|
|
utils/__pycache__/prediction.cpython-310.pyc
CHANGED
Binary files a/utils/__pycache__/prediction.cpython-310.pyc and b/utils/__pycache__/prediction.cpython-310.pyc differ
|
|
utils/model.py
CHANGED
@@ -17,7 +17,7 @@ class EffNet(nn.Module):
|
|
17 |
return out
|
18 |
|
19 |
def load_model():
|
20 |
-
device = torch.device("
|
21 |
net = EffNet(n_classes=2).to(device)
|
22 |
model_path = os.path.join(os.path.dirname(__file__), 'models', 'modelo_galaxias.pth')
|
23 |
net.load_state_dict(torch.load(model_path)) # Adjust path if needed
|
|
|
17 |
return out
|
18 |
|
19 |
def load_model():
|
20 |
+
device = torch.device("cpu")
|
21 |
net = EffNet(n_classes=2).to(device)
|
22 |
model_path = os.path.join(os.path.dirname(__file__), 'models', 'modelo_galaxias.pth')
|
23 |
net.load_state_dict(torch.load(model_path)) # Adjust path if needed
|
utils/prediction.py
CHANGED
@@ -14,7 +14,7 @@ def predict_class(image_tensor, model):
|
|
14 |
"""
|
15 |
|
16 |
with torch.no_grad():
|
17 |
-
device = torch.device("
|
18 |
output = model(image_tensor.to(device))
|
19 |
probabilities = torch.softmax(output, dim=1)
|
20 |
predicted_class_index = torch.argmax(probabilities, dim=1).item()
|
|
|
14 |
"""
|
15 |
|
16 |
with torch.no_grad():
|
17 |
+
device = torch.device("cpu")
|
18 |
output = model(image_tensor.to(device))
|
19 |
probabilities = torch.softmax(output, dim=1)
|
20 |
predicted_class_index = torch.argmax(probabilities, dim=1).item()
|