Suggest guidance value for Flux and non-Flux models

This commit is contained in:
cmdr2
2024-10-08 18:54:06 +05:30
parent 84c8284a90
commit 90bc1456c9
3 changed files with 32 additions and 0 deletions

View File

@ -1858,6 +1858,32 @@ controlImagePreview.addEventListener("load", onControlnetModelChange)
controlImagePreview.addEventListener("unload", onControlnetModelChange)
onControlnetModelChange()
// tip for Flux
let sdModelField = document.querySelector("#stable_diffusion_model")
function checkGuidanceValue() {
let guidance = parseFloat(guidanceScaleField.value)
let guidanceWarning = document.querySelector("#guidanceWarning")
let guidanceWarningText = document.querySelector("#guidanceWarningText")
if (sdModelField.value.toLowerCase().includes("flux")) {
if (guidance > 1.5) {
guidanceWarningText.innerText = "Flux recommends a guidance scale of 1"
guidanceWarning.classList.remove("displayNone")
} else {
guidanceWarning.classList.add("displayNone")
}
} else {
if (guidance < 2) {
guidanceWarningText.innerText = "A higher Guidance Scale is recommended!"
guidanceWarning.classList.remove("displayNone")
} else {
guidanceWarning.classList.add("displayNone")
}
}
}
sdModelField.addEventListener("change", checkGuidanceValue)
guidanceScaleField.addEventListener("change", checkGuidanceValue)
guidanceScaleSlider.addEventListener("change", checkGuidanceValue)
// function onControlImageFilterChange() {
// let filterId = controlImageFilterField.value
// if (filterId.includes("openpose")) {