From 2d0a76c5a48aecd4bb2f20c72949e519272b4e8f Mon Sep 17 00:00:00 2001 From: AssassinJN Date: Wed, 15 Mar 2023 11:13:26 -0400 Subject: [PATCH 1/4] remove task from dome when removing images Changing the functionality to remove task from dom when all images have been removed. This will save system memory in the browser allowing better performance. --- ui/media/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 8f1ecea3..cb8e77ce 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -302,7 +302,7 @@ function showImages(reqBody, res, outputContainer, livePreview) { } if(allHidden === true) { const req = htmlTaskMap.get(parentTaskContainer) - if(!req.isProcessing || req.batchesDone == req.batchCount) {parentTaskContainer.classList.add("displayNone")} + if(!req.isProcessing || req.batchesDone == req.batchCount) {parentTaskContainer.parentNode.removeChild(parentTaskContainer)} } }) }) From 3507f91090066951e246d809f119ee894e1f128a Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 16 Mar 2023 11:12:10 +0530 Subject: [PATCH 2/4] Remove click event for preview image expansion, since it breaks Rabbit Hole --- ui/media/js/main.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 57789cef..23843003 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -318,9 +318,6 @@ function showImages(reqBody, res, outputContainer, livePreview) { imageElem.addEventListener('load', function() { imageItemElem.querySelector('.img_bottom_label').innerText = `${this.naturalWidth} x ${this.naturalHeight}` }) - imageElem.addEventListener('click', function() { - imageModal(this.src) - }) const imageExpandBtn = imageItemElem.querySelector('.imgExpandBtn') imageExpandBtn.addEventListener('click', function() { From ca99b87319438b01c60b712342db1a4a0830f63a Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 16 Mar 2023 11:30:16 +0530 Subject: [PATCH 3/4] Filter NSFW images (if enabled) during live preview --- ui/easydiffusion/renderer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/easydiffusion/renderer.py b/ui/easydiffusion/renderer.py index 8cceb81b..c5dc88b4 100644 --- a/ui/easydiffusion/renderer.py +++ b/ui/easydiffusion/renderer.py @@ -146,6 +146,9 @@ def make_step_callback( def update_temp_img(x_samples, task_temp_images: list): partial_images = [] images = latent_samples_to_images(context, x_samples) + if task_data.block_nsfw: + images = apply_filters(context, "nsfw_checker", images) + for i, img in enumerate(images): buf = img_to_buffer(img, output_format="JPEG") From a3f357732c3ac7837b8c7fe900f49f21ad67f6ef Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Thu, 16 Mar 2023 11:42:31 +0530 Subject: [PATCH 4/4] formatting --- ui/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/index.html b/ui/index.html index 5d7757b4..7112c022 100644 --- a/ui/index.html +++ b/ui/index.html @@ -501,8 +501,8 @@ async function init() { SD.init({ events: { - statusChange: setServerStatus - , idle: onIdle + statusChange: setServerStatus, + idle: onIdle } })