Spaces:
Build error
Build error
Update sr/sr.py
Browse files
sr/sr.py
CHANGED
|
@@ -3,8 +3,8 @@ from PIL import Image
|
|
| 3 |
import numpy as np
|
| 4 |
from .esrgan.RealESRGAN import RealESRGAN
|
| 5 |
def sr(img):
|
| 6 |
-
|
| 7 |
-
device=torch.device("cuda")
|
| 8 |
model = RealESRGAN(device, scale=2)
|
| 9 |
model.load_weights('weights/RealESRGAN_x2.pth', download=True)
|
| 10 |
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
from .esrgan.RealESRGAN import RealESRGAN
|
| 5 |
def sr(img):
|
| 6 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 7 |
+
# device=torch.device("cuda")
|
| 8 |
model = RealESRGAN(device, scale=2)
|
| 9 |
model.load_weights('weights/RealESRGAN_x2.pth', download=True)
|
| 10 |
|