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,11 +16,36 @@
} }
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 {
@ -27,32 +55,39 @@ div {
} }
#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,14 +10,20 @@
<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">
</div>
</fieldset> </fieldset>
<fieldset id="fieldset-config"> <fieldset id="fieldset-config">
<label for="iterations">Images to generate:</label> <label for="iterations">Images to generate:</label>
@ -62,14 +68,15 @@
<option value="832">832</option> <option value="896">896</option> <option value="832">832</option> <option value="896">896</option>
<option value="960">960</option> <option value="1024">1024</option> <option value="960">960</option> <option value="1024">1024</option>
</select> </select>
<label title="Set to -1 for random seed" for="seed">Seed:</label> <label title="Set to -1 for random seed" for="seed">Seed:</label>
<input value="-1" type="number" id="seed" name="seed"> <input value="-1" type="number" id="seed" name="seed">
<button type="button" id="reset-seed">&olarr;</button> <button type="button" id="reset-seed">&olarr;</button>
<input type="checkbox" name="progress_images" id="progress_images"> <input type="checkbox" name="progress_images" id="progress_images">
<label for="progress_images">Display in-progress images (slower)</label> <label for="progress_images">Display in-progress images (slower):</label>
<button type="button" id="reset-all">Reset to Defaults</button> <button type="button" id="reset-all">Reset to Defaults</button>
</div> </fieldset>
<div id="img2img"> <fieldset id="img2img">
<label title="Upload an image to use img2img" for="initimg">Initial image:</label> <label title="Upload an image to use img2img" for="initimg">Initial image:</label>
<input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png"> <input type="file" id="initimg" name="initimg" accept=".jpg, .jpeg, .png">
<button type="button" id="remove-image">Remove Image</button> <button type="button" id="remove-image">Remove Image</button>
@ -77,9 +84,9 @@
<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,12 +97,11 @@
</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">
<div id="progress-container">
<progress id="progress-bar" value="0" max="1"></progress> <progress id="progress-bar" value="0" max="1"></progress>
<span id="cancel-button" title="Cancel">&#10006;</span> <span id="cancel-button" title="Cancel">&#10006;</span>
<br> <br>
@ -104,11 +110,13 @@
<i><span>Postprocessing...</span><span id="processing_cnt">1/3</span></i> <i><span>Postprocessing...</span><span id="processing_cnt">1/3</span></i>
</div> </div>
</div> </div>
</div> </section>
<div id="results"> <div id="results">
<div id="no-results-message"> <div id="no-results-message">
<i><p>No results...</p></i> <i><p>No results...</p></i>
</div> </div>
</div> </div>
</main>
</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; }