mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
support progress for img2img (#215)
WebGUI shows progress bar when an initial image is provided.
This commit is contained in:
parent
a51e18ea98
commit
8ca4d6542d
@ -145,7 +145,7 @@ class DreamServer(BaseHTTPRequestHandler):
|
|||||||
step_writer.write_image(image, seed) # TODO PngWriter to return path
|
step_writer.write_image(image, seed) # TODO PngWriter to return path
|
||||||
url = step_writer.filepath
|
url = step_writer.filepath
|
||||||
self.wfile.write(bytes(json.dumps(
|
self.wfile.write(bytes(json.dumps(
|
||||||
{'event':'step', 'step':step, 'url': url}
|
{'event':'step', 'step':step + 1, 'url': url}
|
||||||
) + '\n',"utf-8"))
|
) + '\n',"utf-8"))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -375,6 +375,7 @@ class DDIMSampler(object):
|
|||||||
x_latent,
|
x_latent,
|
||||||
cond,
|
cond,
|
||||||
t_start,
|
t_start,
|
||||||
|
img_callback=None,
|
||||||
unconditional_guidance_scale=1.0,
|
unconditional_guidance_scale=1.0,
|
||||||
unconditional_conditioning=None,
|
unconditional_conditioning=None,
|
||||||
use_original_steps=False,
|
use_original_steps=False,
|
||||||
@ -410,4 +411,7 @@ class DDIMSampler(object):
|
|||||||
unconditional_guidance_scale=unconditional_guidance_scale,
|
unconditional_guidance_scale=unconditional_guidance_scale,
|
||||||
unconditional_conditioning=unconditional_conditioning,
|
unconditional_conditioning=unconditional_conditioning,
|
||||||
)
|
)
|
||||||
|
if img_callback:
|
||||||
|
img_callback(x_dec, i)
|
||||||
|
|
||||||
return x_dec
|
return x_dec
|
||||||
|
@ -489,6 +489,7 @@ class T2I:
|
|||||||
z_enc,
|
z_enc,
|
||||||
c,
|
c,
|
||||||
t_enc,
|
t_enc,
|
||||||
|
img_callback=callback,
|
||||||
unconditional_guidance_scale=cfg_scale,
|
unconditional_guidance_scale=cfg_scale,
|
||||||
unconditional_conditioning=uc,
|
unconditional_conditioning=uc,
|
||||||
)
|
)
|
||||||
|
@ -61,10 +61,13 @@ async function generateSubmit(form) {
|
|||||||
let formData = Object.fromEntries(new FormData(form));
|
let formData = Object.fromEntries(new FormData(form));
|
||||||
formData.initimg = formData.initimg.name !== '' ? await toBase64(formData.initimg) : null;
|
formData.initimg = formData.initimg.name !== '' ? await toBase64(formData.initimg) : null;
|
||||||
|
|
||||||
|
let strength = 0.75; // TODO let this be specified in the UI
|
||||||
|
let totalSteps = formData.initimg ? Math.floor(.75 * formData.steps) : formData.steps;
|
||||||
|
|
||||||
let progressSectionEle = document.querySelector('#progress-section');
|
let progressSectionEle = document.querySelector('#progress-section');
|
||||||
progressSectionEle.style.display = 'initial';
|
progressSectionEle.style.display = 'initial';
|
||||||
let progressEle = document.querySelector('#progress-bar');
|
let progressEle = document.querySelector('#progress-bar');
|
||||||
progressEle.setAttribute('max', formData.steps);
|
progressEle.setAttribute('max', totalSteps);
|
||||||
let progressImageEle = document.querySelector('#progress-image');
|
let progressImageEle = document.querySelector('#progress-image');
|
||||||
progressImageEle.src = BLANK_IMAGE_URL;
|
progressImageEle.src = BLANK_IMAGE_URL;
|
||||||
|
|
||||||
@ -94,7 +97,7 @@ async function generateSubmit(form) {
|
|||||||
document.querySelector("#no-results-message")?.remove();
|
document.querySelector("#no-results-message")?.remove();
|
||||||
appendOutput(data.files[0],data.files[1],data.config);
|
appendOutput(data.files[0],data.files[1],data.config);
|
||||||
progressEle.setAttribute('value', 0);
|
progressEle.setAttribute('value', 0);
|
||||||
progressEle.setAttribute('max', formData.steps);
|
progressEle.setAttribute('max', totalSteps);
|
||||||
progressImageEle.src = BLANK_IMAGE_URL;
|
progressImageEle.src = BLANK_IMAGE_URL;
|
||||||
} else if (data.event === 'upscaling-started') {
|
} else if (data.event === 'upscaling-started') {
|
||||||
document.getElementById("processing_cnt").textContent=data.processed_file_cnt;
|
document.getElementById("processing_cnt").textContent=data.processed_file_cnt;
|
||||||
|
Loading…
Reference in New Issue
Block a user