This commit is contained in:
justumen
2024-09-17 10:15:55 +02:00
parent 31baddd065
commit 992a2e762d
4 changed files with 14 additions and 4 deletions

View File

@@ -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

View File

@@ -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]

View File

@@ -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)

View File

@@ -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);
}