Spaces:
Running
on
Zero
Running
on
Zero
Update inference_coz.py
Browse files- inference_coz.py +9 -2
inference_coz.py
CHANGED
@@ -295,7 +295,11 @@ if __name__ == "__main__":
|
|
295 |
prev_sr_output_pil = Image.open(prev_sr_output_path).convert('RGB')
|
296 |
rscale = args.upscale
|
297 |
w, h = prev_sr_output_pil.size
|
298 |
-
|
|
|
|
|
|
|
|
|
299 |
cropped_region = prev_sr_output_pil.crop(((w-new_w)//2, (h-new_h)//2, (w+new_w)//2, (h+new_h)//2))
|
300 |
current_sr_input_image_pil = cropped_region.resize((w, h), Image.BICUBIC)
|
301 |
|
@@ -307,7 +311,10 @@ if __name__ == "__main__":
|
|
307 |
elif args.rec_type == 'recursive_multiscale':
|
308 |
prev_sr_output_path = f'{rec_dir}/{rec}.png'
|
309 |
prev_sr_output_pil = Image.open(prev_sr_output_path).convert('RGB')
|
310 |
-
rscale
|
|
|
|
|
|
|
311 |
w, h = prev_sr_output_pil.size
|
312 |
new_w, new_h = w // rscale, h // rscale
|
313 |
cropped_region = prev_sr_output_pil.crop(((w-new_w)//2, (h-new_h)//2, (w+new_w)//2, (h+new_h)//2))
|
|
|
295 |
prev_sr_output_pil = Image.open(prev_sr_output_path).convert('RGB')
|
296 |
rscale = args.upscale
|
297 |
w, h = prev_sr_output_pil.size
|
298 |
+
|
299 |
+
if rscale != 0:
|
300 |
+
new_w, new_h = w // rscale, h // rscale
|
301 |
+
else:
|
302 |
+
new_w, new_h = w, h
|
303 |
cropped_region = prev_sr_output_pil.crop(((w-new_w)//2, (h-new_h)//2, (w+new_w)//2, (h+new_h)//2))
|
304 |
current_sr_input_image_pil = cropped_region.resize((w, h), Image.BICUBIC)
|
305 |
|
|
|
311 |
elif args.rec_type == 'recursive_multiscale':
|
312 |
prev_sr_output_path = f'{rec_dir}/{rec}.png'
|
313 |
prev_sr_output_pil = Image.open(prev_sr_output_path).convert('RGB')
|
314 |
+
if rscale != 0:
|
315 |
+
new_w, new_h = w // rscale, h // rscale
|
316 |
+
else:
|
317 |
+
new_w, new_h = w, h
|
318 |
w, h = prev_sr_output_pil.size
|
319 |
new_w, new_h = w // rscale, h // rscale
|
320 |
cropped_region = prev_sr_output_pil.crop(((w-new_w)//2, (h-new_h)//2, (w+new_w)//2, (h+new_h)//2))
|