Support guidance_scale slider in config

This commit is contained in:
cmdr2 2022-08-24 12:43:50 +05:30
parent 5d305c03e7
commit f73cab5ce8
3 changed files with 12 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -52,7 +52,7 @@
<label for="width">Width:</label> <select id="width" name="width" value="512"><option value="128">128</option><option value="256">256</option><option value="512" selected>512</option><option value="768">768</option><option value="1024">1024</option></select><br/>
<label for="height">Height:</label> <select id="height" name="height" value="512"><option value="128">128</option><option value="256">256</option><option value="512" selected>512</option><option value="768">768</option></select><br/>
<label for="num_inference_steps">Number of inference steps:</label> <input id="num_inference_steps" name="num_inference_steps" value="50"><br/>
<label for="guidance_scale">Guidance Scale:</label> <input id="guidance_scale" name="guidance_scale" value="7.5"><br/>
<label for="guidance_scale">Guidance Scale:</label> <input id="guidance_scale" name="guidance_scale" value="75" type="range" min="10" max="200"> <span id="guidance_scale_value"></span></span><br/>
</div>
<button id="makeImage">Make Image</button> <br/><br/>
@ -123,7 +123,7 @@ async function makeImage() {
prompt: document.querySelector('#prompt').value,
num_outputs: document.querySelector('#num_outputs').value,
num_inference_steps: document.querySelector('#num_inference_steps').value,
guidance_scale: document.querySelector('#guidance_scale').value,
guidance_scale: document.querySelector('#guidance_scale').value / 10,
width: document.querySelector('#width').value,
height: document.querySelector('#height').value,
seed: document.querySelector('#seed').value,
@ -207,6 +207,15 @@ document.querySelector('#configToggleBtn').addEventListener('click', function()
return false
})
let guidanceScale = document.querySelector('#guidance_scale')
function updateGuidanceScale() {
let label = document.querySelector('#guidance_scale_value')
label.innerHTML = guidanceScale.value / 10
}
guidanceScale.addEventListener('input', updateGuidanceScale)
updateGuidanceScale()
setInterval(healthCheck, HEALTH_PING_INTERVAL * 1000)
</script>

View File

@ -41,6 +41,7 @@ async def image(req : ImageRequest):
"width": req.width,
"height": req.height,
"seed": req.seed,
"guidance_scale": req.guidance_scale,
}
}