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 ed840a056a..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; diff --git a/static/dream_web/index.html b/static/dream_web/index.html index 21591ab9b4..31816a2cd4 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..74ab1ef5f5 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() + location.reload() +} + 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")); };