Squashed commit of the following:

commit 0cd48e932f1326e000c46f4140f98697eb9bdc79
Author: Lincoln Stein <lincoln.stein@gmail.com>
Date:   Mon Sep 5 10:27:43 2022 -0400

    resolve conflicts with development

commit d7bc8c12e0
Author: Scott McMillin <scott@scottmcmillin.com>
Date:   Sun Sep 4 18:52:09 2022 -0500

    Add title attribute back to img tag

commit 5397c89184
Author: Scott McMillin <scott@scottmcmillin.com>
Date:   Sun Sep 4 13:49:46 2022 -0500

    Remove temp code

commit 1da080b509
Author: Scott McMillin <scott@scottmcmillin.com>
Date:   Sun Sep 4 13:33:56 2022 -0500

    Cleaned up HTML; small style changes; image click opens image; add seed to figcaption beneath image
This commit is contained in:
Lincoln Stein 2022-09-05 10:31:59 -04:00
parent caf4ea3d89
commit 52d8bb2836
3 changed files with 161 additions and 107 deletions

View File

@ -1,11 +1,14 @@
* { * {
font-family: 'Arial'; font-family: 'Arial';
font-size: 100%;
} }
#header { body {
text-decoration: dotted underline; font-size: 1em;
} }
#search { textarea {
margin-top: 20vh; font-size: 0.95em;
}
header, form, #progress-section {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
max-width: 1024px; max-width: 1024px;
@ -13,46 +16,78 @@
} }
fieldset { fieldset {
border: none; border: none;
line-height: 2.2em;
}
select, input {
margin-right: 10px;
padding: 2px;
}
input[type=submit] {
background-color: #666;
color: white;
}
input[type=checkbox] {
margin-right: 0px;
width: 20px;
height: 20px;
vertical-align: middle;
}
input#seed {
margin-right: 0px;
} }
div { div {
padding: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;
} }
#fieldset-search { header {
margin-bottom: 16px;
}
header h1 {
margin-bottom: 0;
font-size: 2em;
}
#search-box {
display: flex; display: flex;
} }
#scaling-inprocess-message{ #scaling-inprocess-message {
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
display: none; display: none;
} }
#prompt { #prompt {
flex-grow: 1; flex-grow: 1;
border-radius: 20px 0px 0px 20px;
padding: 5px 10px 5px 10px; padding: 5px 10px 5px 10px;
border: 1px solid black; border: 1px solid #999;
border-right: none;
outline: none; outline: none;
} }
#submit { #submit {
border-radius: 0px 20px 20px 0px;
padding: 5px 10px 5px 10px; padding: 5px 10px 5px 10px;
border: 1px solid black; border: 1px solid #999;
} }
#reset-all, #remove-image { #reset-all, #remove-image {
margin-top: 12px;
font-size: 0.8em;
background-color: pink; background-color: pink;
border: 1px solid #999;
border-radius: 4px;
} }
#results { #results {
text-align: center; text-align: center;
// max-width: 1024px;
margin: auto; margin: auto;
padding-top: 10px; padding-top: 10px;
} }
#results img { #results figure {
display: inline-block;
margin: 10px;
}
#results figcaption {
font-size: 0.8em;
padding: 3px;
color: #888;
cursor: pointer; cursor: pointer;
}
#results img {
height: 30vh; height: 30vh;
border-radius: 5px; border-radius: 5px;
margin: 10px;
} }
#fieldset-config { #fieldset-config {
line-height:2em; line-height:2em;
@ -63,8 +98,15 @@ input[type="number"] {
#seed { #seed {
width: 150px; width: 150px;
} }
hr { button#reset-seed {
// width: 200px; font-size: 1.7em;
background: #efefef;
border: 1px solid #999;
border-radius: 4px;
line-height: 0.8;
margin: 0 10px 0 0;
padding: 0 5px 3px;
vertical-align: middle;
} }
label { label {
white-space: nowrap; white-space: nowrap;
@ -92,6 +134,4 @@ label {
#progress-section { #progress-section {
background-color: #F5F5F5; background-color: #F5F5F5;
} }
#about {
background-color: #DCDCDC;
}

View File

@ -10,76 +10,83 @@
<script src="static/dream_web/index.js"></script> <script src="static/dream_web/index.js"></script>
</head> </head>
<body> <body>
<div id="search"> <header>
<h2 id="header">Stable Diffusion Dream Server</h2> <h1>Stable Diffusion Dream Server</h1>
<div id="about">
For news and support for this web service, visit our <a href="http://github.com/lstein/stable-diffusion">GitHub site</a>
</div>
</header>
<main>
<form id="generate-form" method="post" action="#"> <form id="generate-form" method="post" action="#">
<div id="txt2img"> <fieldset id="txt2img">
<fieldset id="fieldset-search"> <div id="search-box">
<input type="text" id="prompt" name="prompt"> <textarea rows="3" id="prompt" name="prompt"></textarea>
<input type="submit" id="submit" value="Generate"> <input type="submit" id="submit" value="Generate">
</fieldset> </div>
<fieldset id="fieldset-config"> </fieldset>
<label for="iterations">Images to generate:</label> <fieldset id="fieldset-config">
<input value="1" type="number" id="iterations" name="iterations" size="4"> <label for="iterations">Images to generate:</label>
<label for="steps">Steps:</label> <input value="1" type="number" id="iterations" name="iterations" size="4">
<input value="50" type="number" id="steps" name="steps"> <label for="steps">Steps:</label>
<label for="cfgscale">Cfg Scale:</label> <input value="50" type="number" id="steps" name="steps">
<input value="7.5" type="number" id="cfgscale" name="cfgscale" step="any"> <label for="cfgscale">Cfg Scale:</label>
<label for="sampler">Sampler:</label> <input value="7.5" type="number" id="cfgscale" name="cfgscale" step="any">
<select id="sampler" name="sampler" value="k_lms"> <label for="sampler">Sampler:</label>
<option value="ddim">DDIM</option> <select id="sampler" name="sampler" value="k_lms">
<option value="plms">PLMS</option> <option value="ddim">DDIM</option>
<option value="k_lms" selected>KLMS</option> <option value="plms">PLMS</option>
<option value="k_dpm_2">KDPM_2</option> <option value="k_lms" selected>KLMS</option>
<option value="k_dpm_2_a">KDPM_2A</option> <option value="k_dpm_2">KDPM_2</option>
<option value="k_euler">KEULER</option> <option value="k_dpm_2_a">KDPM_2A</option>
<option value="k_euler_a">KEULER_A</option> <option value="k_euler">KEULER</option>
<option value="k_heun">KHEUN</option> <option value="k_euler_a">KEULER_A</option>
</select> <option value="k_heun">KHEUN</option>
<input type="checkbox" name="seamless" id="seamless"> </select>
<label for="seamless">Seamless circular tiling</label> <input type="checkbox" name="seamless" id="seamless">
<br> <label for="seamless">Seamless circular tiling</label>
<label title="Set to multiple of 64" for="width">Width:</label> <br>
<select id="width" name="width" value="512"> <label title="Set to multiple of 64" for="width">Width:</label>
<option value="64">64</option> <option value="128">128</option> <select id="width" name="width" value="512">
<option value="192">192</option> <option value="256">256</option> <option value="64">64</option> <option value="128">128</option>
<option value="320">320</option> <option value="384">384</option> <option value="192">192</option> <option value="256">256</option>
<option value="448">448</option> <option value="512" selected>512</option> <option value="320">320</option> <option value="384">384</option>
<option value="576">576</option> <option value="640">640</option> <option value="448">448</option> <option value="512" selected>512</option>
<option value="704">704</option> <option value="768">768</option> <option value="576">576</option> <option value="640">640</option>
<option value="832">832</option> <option value="896">896</option> <option value="704">704</option> <option value="768">768</option>
<option value="960">960</option> <option value="1024">1024</option> <option value="832">832</option> <option value="896">896</option>
</select> <option value="960">960</option> <option value="1024">1024</option>
<label title="Set to multiple of 64" for="height">Height:</label> </select>
<select id="height" name="height" value="512"> <label title="Set to multiple of 64" for="height">Height:</label>
<option value="64">64</option> <option value="128">128</option> <select id="height" name="height" value="512">
<option value="192">192</option> <option value="256">256</option> <option value="64">64</option> <option value="128">128</option>
<option value="320">320</option> <option value="384">384</option> <option value="192">192</option> <option value="256">256</option>
<option value="448">448</option> <option value="512" selected>512</option> <option value="320">320</option> <option value="384">384</option>
<option value="576">576</option> <option value="640">640</option> <option value="448">448</option> <option value="512" selected>512</option>
<option value="704">704</option> <option value="768">768</option> <option value="576">576</option> <option value="640">640</option>
<option value="832">832</option> <option value="896">896</option> <option value="704">704</option> <option value="768">768</option>
<option value="960">960</option> <option value="1024">1024</option> <option value="832">832</option> <option value="896">896</option>
</select> <option value="960">960</option> <option value="1024">1024</option>
<label title="Set to -1 for random seed" for="seed">Seed:</label> </select>
<input value="-1" type="number" id="seed" name="seed">
<button type="button" id="reset-seed">&olarr;</button> <label title="Set to -1 for random seed" for="seed">Seed:</label>
<input type="checkbox" name="progress_images" id="progress_images"> <input value="-1" type="number" id="seed" name="seed">
<label for="progress_images">Display in-progress images (slower)</label> <button type="button" id="reset-seed">&olarr;</button>
<button type="button" id="reset-all">Reset to Defaults</button> <input type="checkbox" name="progress_images" id="progress_images">
</div> <label for="progress_images">Display in-progress images (slower):</label>
<div id="img2img"> <button type="button" id="reset-all">Reset to Defaults</button>
<label title="Upload an image to use img2img" for="initimg">Initial image:</label> </fieldset>
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png"> <fieldset id="img2img">
<button type="button" id="remove-image">Remove Image</button> <label title="Upload an image to use img2img" for="initimg">Initial image:</label>
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png">
<button type="button" id="remove-image">Remove Image</button>
<br> <br>
<label for="strength">Img2Img Strength:</label> <label for="strength">Img2Img Strength:</label>
<input value="0.75" type="number" id="strength" name="strength" step="0.01" min="0" max="1"> <input value="0.75" type="number" id="strength" name="strength" step="0.01" min="0" max="1">
<input type="checkbox" id="fit" name="fit" checked> <input type="checkbox" id="fit" name="fit" checked>
<label title="Rescale image to fit within requested width and height" for="fit">Fit to width/height</label> <label title="Rescale image to fit within requested width and height" for="fit">Fit to width/height:</label>
</div> </fieldset>
<div id="gfpgan"> <fieldset id="gfpgan">
<label title="Strength of the gfpgan (face fixing) algorithm." for="gfpgan_strength">GPFGAN Strength (0 to disable):</label> <label title="Strength of the gfpgan (face fixing) algorithm." for="gfpgan_strength">GPFGAN Strength (0 to disable):</label>
<input value="0.8" min="0" max="1" type="number" id="gfpgan_strength" name="gfpgan_strength" step="0.05"> <input value="0.8" min="0" max="1" type="number" id="gfpgan_strength" name="gfpgan_strength" step="0.05">
<label title="Upscaling to perform using ESRGAN." for="upscale_level">Upscaling Level</label> <label title="Upscaling to perform using ESRGAN." for="upscale_level">Upscaling Level</label>
@ -90,25 +97,26 @@
</select> </select>
<label title="Strength of the esrgan (upscaling) algorithm." for="upscale_strength">Upscale Strength:</label> <label title="Strength of the esrgan (upscaling) algorithm." for="upscale_strength">Upscale Strength:</label>
<input value="0.75" min="0" max="1" type="number" id="upscale_strength" name="upscale_strength" step="0.05"> <input value="0.75" min="0" max="1" type="number" id="upscale_strength" name="upscale_strength" step="0.05">
</div>
</fieldset> </fieldset>
</form> </form>
<div id="about">For news and support for this web service, visit our <a href="http://github.com/lstein/stable-diffusion">GitHub site</a></div>
<br> <br>
<div id="progress-section"> <section id="progress-section">
<progress id="progress-bar" value="0" max="1"></progress> <div id="progress-container">
<span id="cancel-button" title="Cancel">&#10006;</span> <progress id="progress-bar" value="0" max="1"></progress>
<br> <span id="cancel-button" title="Cancel">&#10006;</span>
<img id="progress-image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>'></img> <br>
<div id="scaling-inprocess-message"> <img id="progress-image" src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>'></img>
<i><span>Postprocessing...</span><span id="processing_cnt">1/3</span></i> <div id="scaling-inprocess-message">
<i><span>Postprocessing...</span><span id="processing_cnt">1/3</span></i>
</div>
</div>
</section>
<div id="results">
<div id="no-results-message">
<i><p>No results...</p></i>
</div> </div>
</div> </div>
</div> </main>
<div id="results">
<div id="no-results-message">
<i><p>No results...</p></i>
</div>
</div>
</body> </body>
</html> </html>

View File

@ -8,15 +8,21 @@ function toBase64(file) {
} }
function appendOutput(src, seed, config) { function appendOutput(src, seed, config) {
let outputNode = document.createElement("img"); let outputNode = document.createElement("figure");
outputNode.src = src;
let altText = seed.toString() + " | " + config.prompt; let altText = seed.toString() + " | " + config.prompt;
outputNode.alt = altText;
outputNode.title = altText; const figureContents = `
<a href="${src}" target="_blank">
<img src="${src}" alt="${altText}" title="${altText}">
</a>
<figcaption>${seed}</figcaption>
`;
outputNode.innerHTML = figureContents;
let figcaption = outputNode.querySelector('figcaption')
// Reload image config // Reload image config
outputNode.addEventListener('click', () => { figcaption.addEventListener('click', () => {
let form = document.querySelector("#generate-form"); let form = document.querySelector("#generate-form");
for (const [k, v] of new FormData(form)) { for (const [k, v] of new FormData(form)) {
if (k == 'initimg') { continue; } if (k == 'initimg') { continue; }