Spaces:
Runtime error
Runtime error
changed app to use cpu
Browse files
app.py
CHANGED
|
@@ -18,8 +18,11 @@ from losses import *
|
|
| 18 |
from networks_SRGAN import *
|
| 19 |
from utils import *
|
| 20 |
|
| 21 |
-
device = '
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
NetG = Generator()
|
| 25 |
model_parameters = filter(lambda p: True, NetG.parameters())
|
|
@@ -55,8 +58,6 @@ def predict(img):
|
|
| 55 |
img = lr_transforms(img)
|
| 56 |
lr_tensor = utils.image2tensor(img, range_norm=False, half=False)
|
| 57 |
|
| 58 |
-
device = 'cuda'
|
| 59 |
-
dtype = torch.cuda.FloatTensor
|
| 60 |
xLR = lr_tensor.to(device).unsqueeze(0)
|
| 61 |
xLR = xLR.type(dtype)
|
| 62 |
# pass them through the network
|
|
|
|
| 18 |
from networks_SRGAN import *
|
| 19 |
from utils import *
|
| 20 |
|
| 21 |
+
device = 'cpu'
|
| 22 |
+
if device == 'cuda':
|
| 23 |
+
dtype = torch.cuda.FloatTensor
|
| 24 |
+
else:
|
| 25 |
+
dtype = torch.FloatTensor
|
| 26 |
|
| 27 |
NetG = Generator()
|
| 28 |
model_parameters = filter(lambda p: True, NetG.parameters())
|
|
|
|
| 58 |
img = lr_transforms(img)
|
| 59 |
lr_tensor = utils.image2tensor(img, range_norm=False, half=False)
|
| 60 |
|
|
|
|
|
|
|
| 61 |
xLR = lr_tensor.to(device).unsqueeze(0)
|
| 62 |
xLR = xLR.type(dtype)
|
| 63 |
# pass them through the network
|