Merge pull request #15380 from light-and-ray/interrupt_upscale

interrupt upscale
This commit is contained in:
AUTOMATIC1111 2024-03-30 07:34:34 +03:00 committed by GitHub
commit 642bca4c3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -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)

View File

@ -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])