sdkit 2.0.15.4 - Controlnet strength slider

This commit is contained in:
cmdr2 2024-05-28 18:45:08 +05:30
parent ad649a8050
commit 44789bf16b
6 changed files with 44 additions and 2 deletions

View File

@ -22,7 +22,7 @@ modules_to_check = {
"torch": ("1.11.0", "1.13.1", "2.0.0", "2.0.1"), "torch": ("1.11.0", "1.13.1", "2.0.0", "2.0.1"),
"torchvision": ("0.12.0", "0.14.1", "0.15.1", "0.15.2"), "torchvision": ("0.12.0", "0.14.1", "0.15.1", "0.15.2"),
"setuptools": "69.5.1", "setuptools": "69.5.1",
"sdkit": "2.0.15.3", "sdkit": "2.0.15.4",
"diffusers": "0.21.4", "diffusers": "0.21.4",
"stable-diffusion-sdkit": "2.1.5", "stable-diffusion-sdkit": "2.1.5",
"rich": "12.6.0", "rich": "12.6.0",

View File

@ -31,6 +31,7 @@ TASK_TEXT_MAPPING = {
"clip_skip": "Clip Skip", "clip_skip": "Clip Skip",
"use_controlnet_model": "ControlNet model", "use_controlnet_model": "ControlNet model",
"control_filter_to_apply": "ControlNet Filter", "control_filter_to_apply": "ControlNet Filter",
"control_alpha": "ControlNet Strength",
"use_vae_model": "VAE model", "use_vae_model": "VAE model",
"sampler_name": "Sampler", "sampler_name": "Sampler",
"width": "Width", "width": "Width",

View File

@ -35,7 +35,7 @@
<h1> <h1>
<img id="logo_img" src="/media/images/icon-512x512.png" > <img id="logo_img" src="/media/images/icon-512x512.png" >
Easy Diffusion Easy Diffusion
<small><span id="version">v3.0.8</span> <span id="updateBranchLabel"></span></small> <small><span id="version">v3.0.9</span> <span id="updateBranchLabel"></span></small>
</h1> </h1>
</div> </div>
<div id="server-status"> <div id="server-status">
@ -235,6 +235,8 @@
<label for="controlnet_model"><small>Model:</small></label> <input id="controlnet_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" /> <label for="controlnet_model"><small>Model:</small></label> <input id="controlnet_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
<br/> <br/>
<label><small>Will download the necessary models, the first time.</small></label> <label><small>Will download the necessary models, the first time.</small></label>
<br/>
<label for="controlnet_alpha_slider"><small>Strength:</small></label> <input id="controlnet_alpha_slider" name="controlnet_alpha_slider" class="editor-slider" value="10" type="range" min="0" max="10"> <input id="controlnet_alpha" name="controlnet_alpha" size="4" pattern="^[0-9\.]+$" onkeypress="preventNonNumericalInput(event)" inputmode="decimal">
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -57,6 +57,7 @@ const SETTINGS_IDS_LIST = [
"embedding-card-size-selector", "embedding-card-size-selector",
"lora_model", "lora_model",
"enable_vae_tiling", "enable_vae_tiling",
"controlnet_alpha",
] ]
const IGNORE_BY_DEFAULT = ["prompt"] const IGNORE_BY_DEFAULT = ["prompt"]

View File

@ -309,6 +309,15 @@ const TASK_MAPPING = {
readUI: () => controlImageFilterField.value, readUI: () => controlImageFilterField.value,
parse: (val) => val, parse: (val) => val,
}, },
control_alpha: {
name: "ControlNet Strength",
setUI: (control_alpha) => {
controlAlphaField.value = control_alpha
updateControlAlphaSlider()
},
readUI: () => parseFloat(controlAlphaField.value),
parse: (val) => parseFloat(val),
},
use_lora_model: { use_lora_model: {
name: "LoRA model", name: "LoRA model",
setUI: (use_lora_model) => { setUI: (use_lora_model) => {
@ -587,6 +596,7 @@ const TASK_TEXT_MAPPING = {
lora_alpha: "LoRA Strength", lora_alpha: "LoRA Strength",
use_controlnet_model: "ControlNet model", use_controlnet_model: "ControlNet model",
control_filter_to_apply: "ControlNet Filter", control_filter_to_apply: "ControlNet Filter",
control_alpha: "ControlNet Strength",
tiling: "Seamless Tiling", tiling: "Seamless Tiling",
} }
function parseTaskFromText(str) { function parseTaskFromText(str) {

View File

@ -51,6 +51,10 @@ const taskConfigSetup = {
preserve_init_image_color_profile: "Preserve Color Profile", preserve_init_image_color_profile: "Preserve Color Profile",
strict_mask_border: "Strict Mask Border", strict_mask_border: "Strict Mask Border",
use_controlnet_model: "ControlNet Model", use_controlnet_model: "ControlNet Model",
control_alpha: {
label: "ControlNet Strength",
visible: ({ reqBody }) => !!reqBody?.use_controlnet_model,
},
}, },
pluginTaskConfig: {}, pluginTaskConfig: {},
getCSSKey: (key) => getCSSKey: (key) =>
@ -99,6 +103,8 @@ let controlImagePreview = document.querySelector("#control_image_preview")
let controlImageClearBtn = document.querySelector(".control_image_clear") let controlImageClearBtn = document.querySelector(".control_image_clear")
let controlImageContainer = document.querySelector("#control_image_wrapper") let controlImageContainer = document.querySelector("#control_image_wrapper")
let controlImageFilterField = document.querySelector("#control_image_filter") let controlImageFilterField = document.querySelector("#control_image_filter")
let controlAlphaSlider = document.querySelector("#controlnet_alpha_slider")
let controlAlphaField = document.querySelector("#controlnet_alpha")
let applyColorCorrectionField = document.querySelector("#apply_color_correction") let applyColorCorrectionField = document.querySelector("#apply_color_correction")
let strictMaskBorderField = document.querySelector("#strict_mask_border") let strictMaskBorderField = document.querySelector("#strict_mask_border")
let colorCorrectionSetting = document.querySelector("#apply_color_correction_setting") let colorCorrectionSetting = document.querySelector("#apply_color_correction_setting")
@ -1395,6 +1401,7 @@ function getCurrentUserRequest() {
if (controlnetModelField.value !== "" && IMAGE_REGEX.test(controlImagePreview.src)) { if (controlnetModelField.value !== "" && IMAGE_REGEX.test(controlImagePreview.src)) {
newTask.reqBody.use_controlnet_model = controlnetModelField.value newTask.reqBody.use_controlnet_model = controlnetModelField.value
newTask.reqBody.control_image = controlImagePreview.src newTask.reqBody.control_image = controlImagePreview.src
newTask.reqBody.control_alpha = parseFloat(controlAlphaField.value)
if (controlImageFilterField.value !== "") { if (controlImageFilterField.value !== "") {
newTask.reqBody.control_filter_to_apply = controlImageFilterField.value newTask.reqBody.control_filter_to_apply = controlImageFilterField.value
} }
@ -2015,6 +2022,27 @@ function updateHypernetworkStrengthContainer() {
hypernetworkModelField.addEventListener("change", updateHypernetworkStrengthContainer) hypernetworkModelField.addEventListener("change", updateHypernetworkStrengthContainer)
updateHypernetworkStrengthContainer() updateHypernetworkStrengthContainer()
/********************* Controlnet Alpha **************************/
function updateControlAlpha() {
controlAlphaField.value = controlAlphaSlider.value / 10
controlAlphaField.dispatchEvent(new Event("change"))
}
function updateControlAlphaSlider() {
if (controlAlphaField.value < 0) {
controlAlphaField.value = 0
} else if (controlAlphaField.value > 10) {
controlAlphaField.value = 10
}
controlAlphaSlider.value = controlAlphaField.value * 10
controlAlphaSlider.dispatchEvent(new Event("change"))
}
controlAlphaSlider.addEventListener("input", updateControlAlpha)
controlAlphaField.addEventListener("input", updateControlAlphaSlider)
updateControlAlpha()
/********************* JPEG/WEBP Quality **********************/ /********************* JPEG/WEBP Quality **********************/
function updateOutputQuality() { function updateOutputQuality() {
outputQualityField.value = 0 | outputQualitySlider.value outputQualityField.value = 0 | outputQualitySlider.value