Spaces:
Running
on
Zero
Running
on
Zero
Update infer.py
Browse files
infer.py
CHANGED
@@ -10,7 +10,7 @@ import ffmpeg
|
|
10 |
|
11 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
12 |
|
13 |
-
def infer_image(img: Image.Image, size_modifier:
|
14 |
if img is None:
|
15 |
raise Exception("Image not uploaded")
|
16 |
|
@@ -19,6 +19,7 @@ def infer_image(img: Image.Image, size_modifier: int ) -> Image.Image:
|
|
19 |
if width >= 5000 or height >= 5000:
|
20 |
raise Exception("The image is too large.")
|
21 |
|
|
|
22 |
model = RealESRGAN(device, scale=size_modifier)
|
23 |
model.load_weights(f'weights/RealESRGAN_x{size_modifier}.pth', download=False)
|
24 |
|
|
|
10 |
|
11 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
12 |
|
13 |
+
def infer_image(img: Image.Image, size_modifier: str) -> Image.Image:
|
14 |
if img is None:
|
15 |
raise Exception("Image not uploaded")
|
16 |
|
|
|
19 |
if width >= 5000 or height >= 5000:
|
20 |
raise Exception("The image is too large.")
|
21 |
|
22 |
+
size_modifier = int(size_modifier) # Convert size_modifier to an integer
|
23 |
model = RealESRGAN(device, scale=size_modifier)
|
24 |
model.load_weights(f'weights/RealESRGAN_x{size_modifier}.pth', download=False)
|
25 |
|