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
|
||||
url = step_writer.filepath
|
||||
self.wfile.write(bytes(json.dumps(
|
||||
{'event':'step', 'step':step, 'url': url}
|
||||
{'event':'step', 'step':step + 1, 'url': url}
|
||||
) + '\n',"utf-8"))
|
||||
|
||||
try:
|
||||
|
@ -375,6 +375,7 @@ class DDIMSampler(object):
|
||||
x_latent,
|
||||
cond,
|
||||
t_start,
|
||||
img_callback=None,
|
||||
unconditional_guidance_scale=1.0,
|
||||
unconditional_conditioning=None,
|
||||
use_original_steps=False,
|
||||
@ -410,4 +411,7 @@ class DDIMSampler(object):
|
||||
unconditional_guidance_scale=unconditional_guidance_scale,
|
||||
unconditional_conditioning=unconditional_conditioning,
|
||||
)
|
||||
if img_callback:
|
||||
img_callback(x_dec, i)
|
||||
|
||||
return x_dec
|
||||
|
@ -489,6 +489,7 @@ class T2I:
|
||||
z_enc,
|
||||
c,
|
||||
t_enc,
|
||||
img_callback=callback,
|
||||
unconditional_guidance_scale=cfg_scale,
|
||||
unconditional_conditioning=uc,
|
||||
)
|
||||
|
@ -61,10 +61,13 @@ async function generateSubmit(form) {
|
||||
let formData = Object.fromEntries(new FormData(form));
|
||||
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');
|
||||
progressSectionEle.style.display = 'initial';
|
||||
let progressEle = document.querySelector('#progress-bar');
|
||||
progressEle.setAttribute('max', formData.steps);
|
||||
progressEle.setAttribute('max', totalSteps);
|
||||
let progressImageEle = document.querySelector('#progress-image');
|
||||
progressImageEle.src = BLANK_IMAGE_URL;
|
||||
|
||||
@ -94,7 +97,7 @@ async function generateSubmit(form) {
|
||||
document.querySelector("#no-results-message")?.remove();
|
||||
appendOutput(data.files[0],data.files[1],data.config);
|
||||
progressEle.setAttribute('value', 0);
|
||||
progressEle.setAttribute('max', formData.steps);
|
||||
progressEle.setAttribute('max', totalSteps);
|
||||
progressImageEle.src = BLANK_IMAGE_URL;
|
||||
} else if (data.event === 'upscaling-started') {
|
||||
document.getElementById("processing_cnt").textContent=data.processed_file_cnt;
|
||||
|
Loading…
Reference in New Issue
Block a user