Addes support for tailed diffusion

pull/75/head
ilian.iliev 2024-10-06 14:59:40 +03:00
parent e61a4593a7
commit 46a56f8af5
3 changed files with 10 additions and 4 deletions

View File

@ -48,6 +48,7 @@ state.core = (function () {
const TOGGLE_BUTTONS = { // Toggle buttons const TOGGLE_BUTTONS = { // Toggle buttons
'hires_fix': 'hr', 'hires_fix': 'hr',
'refiner': 'enable', 'refiner': 'enable',
'tiled_diffusion': 'MD-t2i-enabled',
}; };
// *** Exceptions *** // // *** Exceptions *** //
@ -63,6 +64,7 @@ state.core = (function () {
'upscaler_scale_to_crop', 'upscaler_scale_to_crop',
'upscaler_1', 'upscaler_1',
'upscaler_2', 'upscaler_2',
'tiled_diffusion',
]; ];
// Elements that have the same id in different tabs // Elements that have the same id in different tabs
@ -75,6 +77,7 @@ state.core = (function () {
'upscaler_scale_to_crop', 'upscaler_scale_to_crop',
'upscaler_1', 'upscaler_1',
'upscaler_2', 'upscaler_2',
'tiled_diffusion',
]; ];
let store = null; let store = null;
@ -349,7 +352,7 @@ state.core = (function () {
function handleToggleButton(id, duplicateIds) { function handleToggleButton(id, duplicateIds) {
let btn = gradioApp().querySelector(`button#${id}`); let btn = gradioApp().querySelector(`button#${id}`);
if (! btn) { // New gradio version if (! btn) { // New gradio version
btn = gradioApp().querySelector(`.input-accordion#${id}`); btn = gradioApp().querySelector(`.input-accordion#${id} .label-wrap`);
} }
if (! btn) { if (! btn) {
state.logging.warn(`Button not found: ${id}`); state.logging.warn(`Button not found: ${id}`);
@ -359,7 +362,7 @@ state.core = (function () {
state.utils.clickToggleMenu(btn); state.utils.clickToggleMenu(btn);
} }
btn.addEventListener('click', function () { btn.addEventListener('click', function () {
let classList = Array.from(this.classList); let classList = Array.from(this.parentNode.classList);
if (btn.tagName === 'BUTTON') { // Old gradio version if (btn.tagName === 'BUTTON') { // Old gradio version
store.set(id, classList.indexOf('secondary-down') === -1); store.set(id, classList.indexOf('secondary-down') === -1);
} else { } else {

View File

@ -35,12 +35,13 @@ state.utils = {
cancelable: true cancelable: true
}); });
element.dispatchEvent(mouseEvent); element.dispatchEvent(mouseEvent);
let icon = element.querySelector('.icon'); let icon = element.parentNode.querySelector('.icon');
if (icon) { if (icon) {
icon.dispatchEvent(mouseEvent); icon.dispatchEvent(mouseEvent);
} }
let checkbox = element.querySelector('input[type="checkbox"]'); let checkbox = element.parentNode.querySelector('input[type="checkbox"]');
if (checkbox) { if (checkbox) {
checkbox.checked = !checkbox.checked;
checkbox.dispatchEvent(mouseEvent); checkbox.dispatchEvent(mouseEvent);
} }
return element; return element;

View File

@ -45,6 +45,7 @@ def on_ui_settings():
"upscaler_1", "upscaler_1",
"upscaler_2", "upscaler_2",
"upscaler_2_visibility", "upscaler_2_visibility",
"tiled_diffusion",
"script" "script"
] ]
}, section=section)) }, section=section))
@ -76,6 +77,7 @@ def on_ui_settings():
"cfg_scale", "cfg_scale",
"denoising_strength", "denoising_strength",
"seed", "seed",
"tiled_diffusion",
"script" "script"
] ]
}, section=section)) }, section=section))