Skip to content

Commit

Permalink
Upscale: resize document only after generation has finished
Browse files Browse the repository at this point in the history
this allows cancelling the operation without modifications
  • Loading branch information
Acly committed Dec 14, 2023
1 parent 0c42f5f commit 45bb882
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ai_diffusion/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ async def _upscale_image(self, job: Job, image: Image, params: UpscaleParams):
else:
work = workflow.upscale_simple(client, image, params.upscaler, params.factor)
job.id = await client.enqueue(work)
self._doc.resize(params.target_extent)

def generate_live(self):
ver = resolve_sd_version(self.style, self._connection.client)
Expand Down Expand Up @@ -320,6 +319,8 @@ def add_upscale_layer(self, job: Job):
if self._layer:
self._layer.remove()
self._layer = None
self._doc.resize(job.bounds.extent)
self.upscale.target_extent_changed.emit(self.upscale.target_extent)
self._doc.insert_layer(job.prompt, job.results[0], job.bounds)

def set_workspace(self, workspace: Workspace):
Expand Down

0 comments on commit 45bb882

Please sign in to comment.