add cuda device in app.py
This commit is contained in:
parent
2d91193a98
commit
ac442f82ac
@ -12,6 +12,9 @@ import torch.nn as nn
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||||
|
torch.set_default_device(device)
|
||||||
|
|
||||||
# Image transformation
|
# Image transformation
|
||||||
imsize = 512 if torch.cuda.is_available() else 128
|
imsize = 512 if torch.cuda.is_available() else 128
|
||||||
loader = transforms.Compose([
|
loader = transforms.Compose([
|
||||||
|
Loading…
Reference in New Issue
Block a user