From 992a2e762d863cdede4ebee0ac3e305709989c72 Mon Sep 17 00:00:00 2001 From: justumen Date: Tue, 17 Sep 2024 10:15:55 +0200 Subject: [PATCH] 0.36 --- README.md | 3 ++- pyproject.toml | 2 +- random_model_clip_vae.py | 7 +++++-- web/js/random_model_clip_vae.js | 6 ++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a599415..29c9f7e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 🔗 Comfyui : Bjornulf_custom_nodes v0.35 🔗 +# 🔗 Comfyui : Bjornulf_custom_nodes v0.36 🔗 # ❤️ Coffee : ☕☕☕☕☕ 5/5 @@ -83,6 +83,7 @@ wget --content-disposition -P /workspace/ComfyUI/models/checkpoints "https://civ - **v0.33**: Control random on paused nodes, fix pydub sound bug permissions on Windows. - **v0.34**: Two new nodes : Load Images from output folder and Select an Image, Pick. - **v0.35**: Great improvements of the TTS node 31. It will also save the audio file in the "ComfyUI/Bjornulf_TTS/" folder. - Not tested on windows yet - +- **v0.36**: Fix random model. # 📝 Nodes descriptions diff --git a/pyproject.toml b/pyproject.toml index 13c7b4b..713a074 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "bjornulf_custom_nodes" description = "Nodes: Ollama, Text to Speech, Combine Texts, Random Texts, Save image for Bjornulf LobeChat, Text with random Seed, Random line from input, Combine images, Image to grayscale (black & white), Remove image Transparency (alpha), Resize Image, ..." -version = "0.35" +version = "0.36" license = {file = "LICENSE"} [project.urls] diff --git a/random_model_clip_vae.py b/random_model_clip_vae.py index 869df78..2d2afe5 100644 --- a/random_model_clip_vae.py +++ b/random_model_clip_vae.py @@ -1,4 +1,5 @@ import random +import json class RandomModelClipVae: @classmethod @@ -12,11 +13,12 @@ class RandomModelClipVae: "model_2": ("MODEL", {"forceInput": True}), "clip_2": ("CLIP", {"forceInput": True}), "vae_2": ("VAE", {"forceInput": True}), + "seed": ("INT", {"default": 0}), }, "hidden": { **{f"model_{i}": ("MODEL", {"forceInput": True}) for i in range(3, 11)}, **{f"clip_{i}": ("CLIP", {"forceInput": True}) for i in range(3, 11)}, - **{f"vae_{i}": ("VAE", {"forceInput": True}) for i in range(3, 11)} + **{f"vae_{i}": ("VAE", {"forceInput": True}) for i in range(3, 11)}, } } @@ -24,10 +26,11 @@ class RandomModelClipVae: FUNCTION = "random_select" def random_select(self, number_of_inputs, **kwargs): + random.seed(kwargs.get('seed', 0)) selected_index = random.randint(1, number_of_inputs) selected_model = kwargs[f"model_{selected_index}"] selected_clip = kwargs[f"clip_{selected_index}"] selected_vae = kwargs[f"vae_{selected_index}"] - return (selected_model, selected_clip, selected_vae) + return (selected_model, selected_clip, selected_vae) \ No newline at end of file diff --git a/web/js/random_model_clip_vae.js b/web/js/random_model_clip_vae.js index 5924c5a..6a6a307 100644 --- a/web/js/random_model_clip_vae.js +++ b/web/js/random_model_clip_vae.js @@ -58,6 +58,12 @@ app.registerExtension({ }; } + // Set seed widget to hidden input + const seedWidget = node.widgets.find((w) => w.name === "seed"); + if (seedWidget) { + seedWidget.type = "HIDDEN"; + } + // Delay the initial update to ensure node is fully initialized setTimeout(updateInputs, 0); }