From c321680b3d6ea13c12d5836a2803f04cd45dba83 Mon Sep 17 00:00:00 2001 From: Andray Date: Tue, 26 Mar 2024 14:53:38 +0400 Subject: [PATCH] interrupt upscale --- modules/upscaler.py | 3 +++ modules/upscaler_utils.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/modules/upscaler.py b/modules/upscaler.py index 4ffd428c6..59f8fbbf5 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -60,6 +60,9 @@ class Upscaler: if img.width >= dest_w and img.height >= dest_h: break + if shared.state.interrupted: + break + shape = (img.width, img.height) img = self.do_upscale(img, selected_model) diff --git a/modules/upscaler_utils.py b/modules/upscaler_utils.py index 17223ca0d..5ecbbed96 100644 --- a/modules/upscaler_utils.py +++ b/modules/upscaler_utils.py @@ -69,6 +69,8 @@ def upscale_with_model( for y, h, row in grid.tiles: newrow = [] for x, w, tile in row: + if shared.state.interrupted: + return img output = upscale_pil_patch(model, tile) scale_factor = output.width // tile.width newrow.append([x * scale_factor, w * scale_factor, output])