From d0d95d3a2a4b7a91c5c4f570d88af43a2c3afe75 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sat, 3 Sep 2022 14:10:31 -0400 Subject: [PATCH] make initimg appear in web log --- ldm/dream/server.py | 2 +- static/dream_web/index.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ldm/dream/server.py b/ldm/dream/server.py index 37020eba29..1c9508e792 100644 --- a/ldm/dream/server.py +++ b/ldm/dream/server.py @@ -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 diff --git a/static/dream_web/index.js b/static/dream_web/index.js index cbd66366f4..ceaef32f09 100644 --- a/static/dream_web/index.js +++ b/static/dream_web/index.js @@ -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;