make initimg appear in web log

This commit is contained in:
Lincoln Stein 2022-09-03 14:10:31 -04:00
parent b90a215000
commit d0d95d3a2a
2 changed files with 4 additions and 2 deletions

View File

@ -87,7 +87,7 @@ class DreamServer(BaseHTTPRequestHandler):
# across images generated by each call to prompt2img(), so we define it in
# the outer scope of image_done()
config = post_data.copy() # Shallow copy
config['initimg'] = ''
config['initimg'] = config.pop('initimg_name','')
images_generated = 0 # helps keep track of when upscaling is started
images_upscaled = 0 # helps keep track of when upscaling is completed

View File

@ -19,7 +19,8 @@ function appendOutput(src, seed, config) {
outputNode.addEventListener('click', () => {
let form = document.querySelector("#generate-form");
for (const [k, v] of new FormData(form)) {
form.querySelector(`*[name=${k}]`).value = config[k];
if (k == 'initimg') { continue; }
form.querySelector(`*[name=${k}]`).value = config[k];
}
document.querySelector("#seed").value = seed;
@ -59,6 +60,7 @@ async function generateSubmit(form) {
// Convert file data to base64
let formData = Object.fromEntries(new FormData(form));
formData.initimg_name = formData.initimg.name
formData.initimg = formData.initimg.name !== '' ? await toBase64(formData.initimg) : null;
let strength = formData.strength;