mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
wip base64
This commit is contained in:
parent
5322d735ee
commit
d1dfd257f9
@ -604,15 +604,11 @@ class InvokeAIWebServer:
|
|||||||
progress.set_current_status("Generating")
|
progress.set_current_status("Generating")
|
||||||
progress.set_current_status_has_steps(True)
|
progress.set_current_status_has_steps(True)
|
||||||
|
|
||||||
wants_progress_image = generation_parameters['progress_images'] and step % 5 == 0
|
|
||||||
wants_progress_latents = generation_parameters['progress_latents']
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
wants_progress_image | wants_progress_latents
|
generation_parameters['progress_images'] and step % 5 == 0 \
|
||||||
and step < generation_parameters['steps'] - 1
|
and step < generation_parameters['steps'] - 1
|
||||||
):
|
):
|
||||||
image = self.generate.sample_to_image(sample) if wants_progress_image \
|
image = self.generate.sample_to_image(sample)
|
||||||
else self.generate.sample_to_lowres_estimated_image(sample)
|
|
||||||
metadata = self.parameters_to_generated_image_metadata(
|
metadata = self.parameters_to_generated_image_metadata(
|
||||||
generation_parameters
|
generation_parameters
|
||||||
)
|
)
|
||||||
@ -640,6 +636,25 @@ class InvokeAIWebServer:
|
|||||||
"height": height,
|
"height": height,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if generation_parameters['progress_latents']:
|
||||||
|
image = self.generate.sample_to_lowres_estimated_image(sample)
|
||||||
|
(width, height) = image.size
|
||||||
|
buffered = io.BytesIO()
|
||||||
|
image.save(buffered, format="PNG")
|
||||||
|
img_str = base64.b64encode(buffered.getvalue())
|
||||||
|
img_base64 = bytes("data:image/jpeg;base64,", encoding='utf-8') + img_str
|
||||||
|
self.socketio.emit(
|
||||||
|
"intermediateResult",
|
||||||
|
{
|
||||||
|
"url": img_base64,
|
||||||
|
"mtime": 0,
|
||||||
|
"metadata": {},
|
||||||
|
"width": width,
|
||||||
|
"height": height,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.socketio.emit("progressUpdate", progress.to_formatted_dict())
|
self.socketio.emit("progressUpdate", progress.to_formatted_dict())
|
||||||
eventlet.sleep(0)
|
eventlet.sleep(0)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user