From 1097b197327aabc8e9651a84e748d353783cb8f4 Mon Sep 17 00:00:00 2001 From: Level Pixel Dev Date: Mon, 3 Feb 2025 18:34:00 +0600 Subject: [PATCH] Added Delay node --- __init__.py | 1 + cpp_agent_req.txt | 2 +- nodes/utils/utils_LP.py | 42 +++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 nodes/utils/utils_LP.py diff --git a/__init__.py b/__init__.py index 42d136f..6a85e91 100644 --- a/__init__.py +++ b/__init__.py @@ -48,6 +48,7 @@ node_list = [ "unloaders.model_unloaders_LP", "vlm.autotagger_LP", "vlm.llava_LP", + "utils.utils_LP", ] NODE_CLASS_MAPPINGS = {} diff --git a/cpp_agent_req.txt b/cpp_agent_req.txt index 3f931fc..930c282 100644 --- a/cpp_agent_req.txt +++ b/cpp_agent_req.txt @@ -1,4 +1,4 @@ -llama-cpp-agent>=0.2.35 +llama-cpp-agent mkdocs mkdocs-material mkdocstrings[python] diff --git a/nodes/utils/utils_LP.py b/nodes/utils/utils_LP.py new file mode 100644 index 0000000..d00dcfd --- /dev/null +++ b/nodes/utils/utils_LP.py @@ -0,0 +1,42 @@ +import time + +class AnyType(str): + def __ne__(self, __value: object) -> bool: + return False + +any = AnyType("*") + +class Delay: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "input": (any, {"defaultInput": True}), + "delay_seconds": ("FLOAT", { + "default": 1.0, + "min": 0.0, + "step": 0.1 + }), + }, + } + + RETURN_TYPES = (any,) + RETURN_NAMES = ("output",) + FUNCTION = "add_delay" + CATEGORY = "LevelPixel/Unloaders" + + def add_delay(self, input, delay_seconds): + delay_text = f"{delay_seconds:.1f} second{'s' if delay_seconds != 1 else ''}" + print(f"[Delay Node] Starting delay of {delay_text}") + time.sleep(delay_seconds) + print(f"[Delay Node] Delay of {delay_text} completed") + return (input,) + +NODE_CLASS_MAPPINGS = { + "Delay|LP": Delay, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "Delay|LP": "Delay [LP]", +} + diff --git a/pyproject.toml b/pyproject.toml index 1542947..8693607 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_level_pixel" description = "Various nodes of the Level Pixel company. Includes convenient advanced nodes for working with images from folders; counting files in a folder; cleaning memory; tag filters. Model Unloader, LLM Unloader (GGUF unloaders), Free memory, Tag Filters, Tag Category Filters, Tag Choice Parser, File counter, Image Loader From Path (with counters), Image Remove Background based on RemBG, Autotagger." -version = "1.1.1" +version = "1.1.2" license = { file = "LICENSE" } dependencies = ["torch>=2.0.1", "torchvision>=0.15.2", "pillow>=9.4.0", "numpy", "matplotlib", "scikit-build-core>=0.10.7", "rembg>=2.0.59", "onnxruntime-gpu>=1.20.0", "onnxruntime>=1.20.0", "googletrans", "langdetect", "httpcore", "deep_translator"]