add cuda device in app.py

This commit is contained in:
s486797 2024-08-23 12:18:48 +02:00
parent 2d91193a98
commit ac442f82ac

View File

@ -12,6 +12,9 @@ import torch.nn as nn
app = Flask(__name__)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
torch.set_default_device(device)
# Image transformation
imsize = 512 if torch.cuda.is_available() else 128
loader = transforms.Compose([