Skip to content

Commit

Permalink
Merge pull request #15380 from light-and-ray/interrupt_upscale
Browse files Browse the repository at this point in the history
interrupt upscale
  • Loading branch information
AUTOMATIC1111 authored Mar 30, 2024
2 parents 80b8710 + c321680 commit 642bca4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/upscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def upscale(self, img: PIL.Image, scale, selected_model: str = None):
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)
Expand Down
2 changes: 2 additions & 0 deletions modules/upscaler_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 642bca4

Please sign in to comment.