From 22365a3f12a224e59cbd9dd555c0eabc13456616 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sun, 28 Aug 2022 21:04:32 -0400 Subject: [PATCH 1/4] begin adding fields for GFPGAN and ESRGAN adjustment; only making public because need to switch computers --- static/dream_web/index.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/static/dream_web/index.html b/static/dream_web/index.html index 21591ab9b4..388e579330 100644 --- a/static/dream_web/index.html +++ b/static/dream_web/index.html @@ -53,8 +53,17 @@
- - +

The options below require the GFPGAN and ESRGAN packages to be installed

+ + + + + +
For news and support for this web service, visit our GitHub site
From e2ae6d288dfa6c72ce2e1b01e730b87f39fb5158 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sun, 28 Aug 2022 21:35:52 -0400 Subject: [PATCH 2/4] added reset to defaults button and sampler selection --- static/dream_web/index.css | 2 +- static/dream_web/index.html | 20 ++++++++++++++++---- static/dream_web/index.js | 9 +++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/static/dream_web/index.css b/static/dream_web/index.css index ed840a056a..482de93e16 100644 --- a/static/dream_web/index.css +++ b/static/dream_web/index.css @@ -48,7 +48,7 @@ img { line-height:2em; } input[type="number"] { - width: 60px; + width: 30px; } #seed { width: 150px; diff --git a/static/dream_web/index.html b/static/dream_web/index.html index 388e579330..79b4c9fc67 100644 --- a/static/dream_web/index.html +++ b/static/dream_web/index.html @@ -18,12 +18,22 @@
- + - + + +
+ +

The options below require the GFPGAN and ESRGAN packages to be installed

- + - +
For news and support for this web service, visit our GitHub site
diff --git a/static/dream_web/index.js b/static/dream_web/index.js index 3b99deecf4..df5ff82a9d 100644 --- a/static/dream_web/index.js +++ b/static/dream_web/index.js @@ -43,6 +43,7 @@ function saveFields(form) { } } } + function loadFields(form) { for (const [k, v] of new FormData(form)) { const item = localStorage.getItem(k); @@ -52,6 +53,11 @@ function loadFields(form) { } } +function clearFields(form) { + localStorage.clear() + form.reset() +} + async function generateSubmit(form) { const prompt = document.querySelector("#prompt").value; @@ -97,5 +103,8 @@ window.onload = () => { document.querySelector("#seed").value = -1; saveFields(e.target.form); }); + document.querySelector("#reset-all").addEventListener('click', (e) => { + clearFields(e.target.form); + }); loadFields(document.querySelector("#generate-form")); }; From 18899be4ae769a9a49bb4f0a30127f3f3762eb0e Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Sun, 28 Aug 2022 22:42:31 -0400 Subject: [PATCH 3/4] working, but there is a bug in underlying txt2png() call that is preventing upscaled images from being returned --- ldm/dream/server.py | 11 +++++++++-- static/dream_web/index.css | 5 ++++- static/dream_web/index.html | 8 ++++---- static/dream_web/index.js | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ldm/dream/server.py b/ldm/dream/server.py index e2eabc3e43..4133eb287c 100644 --- a/ldm/dream/server.py +++ b/ldm/dream/server.py @@ -46,6 +46,9 @@ class DreamServer(BaseHTTPRequestHandler): height = int(post_data['height']) cfgscale = float(post_data['cfgscale']) gfpgan_strength = float(post_data['gfpgan_strength']) + upscale_level = post_data['upscale_level'] + upscale_strength = post_data['upscale_strength'] + upscale = [int(upscale_level),float(upscale_strength)] if upscale_level != '' else None seed = None if int(post_data['seed']) == -1 else int(post_data['seed']) print(f"Request to generate with prompt: {prompt}") @@ -60,7 +63,9 @@ class DreamServer(BaseHTTPRequestHandler): height = height, seed = seed, steps = steps, - gfpgan_strength = gfpgan_strength) + gfpgan_strength = gfpgan_strength, + upscale = upscale + ) else: # Decode initimg as base64 to temp file with open("./img2img-tmp.png", "wb") as f: @@ -74,7 +79,9 @@ class DreamServer(BaseHTTPRequestHandler): cfg_scale = cfgscale, seed = seed, gfpgan_strength=gfpgan_strength, - steps = steps) + upscale = upscale, + steps = steps + ) # Remove the temp file os.remove("./img2img-tmp.png") diff --git a/static/dream_web/index.css b/static/dream_web/index.css index 482de93e16..d4240d3f35 100644 --- a/static/dream_web/index.css +++ b/static/dream_web/index.css @@ -32,6 +32,9 @@ fieldset { padding: 5px 10px 5px 10px; border: 1px solid black; } +#reset-all { + background-color: pink; +} #results { text-align: center; max-width: 1000px; @@ -48,7 +51,7 @@ img { line-height:2em; } input[type="number"] { - width: 30px; + width: 60px; } #seed { width: 150px; diff --git a/static/dream_web/index.html b/static/dream_web/index.html index 79b4c9fc67..23e177905b 100644 --- a/static/dream_web/index.html +++ b/static/dream_web/index.html @@ -68,14 +68,14 @@

The options below require the GFPGAN and ESRGAN packages to be installed

- - - - + +
For news and support for this web service, visit our GitHub site
diff --git a/static/dream_web/index.js b/static/dream_web/index.js index df5ff82a9d..74ab1ef5f5 100644 --- a/static/dream_web/index.js +++ b/static/dream_web/index.js @@ -55,7 +55,7 @@ function loadFields(form) { function clearFields(form) { localStorage.clear() - form.reset() + location.reload() } async function generateSubmit(form) { From e351d6ffe5eda3f5c922100e594ccb87ee615254 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Mon, 29 Aug 2022 00:06:42 -0400 Subject: [PATCH 4/4] set correct default values for scaling and sampler; closes issues #167 #157 --- static/dream_web/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/dream_web/index.html b/static/dream_web/index.html index 23e177905b..31816a2cd4 100644 --- a/static/dream_web/index.html +++ b/static/dream_web/index.html @@ -27,7 +27,7 @@