From 3b58ec5bdf28082d70a2c2203fbcdd8bd3b08d0a Mon Sep 17 00:00:00 2001 From: nickve28 Date: Sat, 17 Aug 2024 06:57:42 +0200 Subject: [PATCH] fix input default signature for strings so it works in new comfy --- nodes.py | 7 +++---- utils/tensor_utils.py | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nodes.py b/nodes.py index c1acd1c..4aa5de2 100644 --- a/nodes.py +++ b/nodes.py @@ -7,7 +7,6 @@ import re import random from PIL import Image -from operator import attrgetter from .utils.file_utils import filename_without_extension, list_images from .utils.tensor_utils import pil_to_tens @@ -23,7 +22,7 @@ def INPUT_TYPES(cls): return { "required": { "input": ("STRING", {}), - "regexp_filter": ("STRING", { "default": None, "multiline": True }), + "regexp_filter": ("STRING", { "default": "", "multiline": True }), "delimiter": ("STRING", { "default": " ", "multiline": False }) } } @@ -57,7 +56,7 @@ def INPUT_TYPES(cls): "include_subdirectories": ("BOOLEAN", { "default": False }), }, "optional": { - "regexp_filter": ("STRING", { "default": None, "multiline": True }) + "regexp_filter": ("STRING", { "default": "", "multiline": True }) }, "hidden": {"unique_id": "UNIQUE_ID"} } @@ -90,7 +89,7 @@ def sample_images(self, *_args, **kwargs): regexp_filter = kwargs['regexp_filter'] include_subdirectories = kwargs['include_subdirectories'] unique_id = kwargs['unique_id'] - + # todo, this image logic is a bit underestimated # make an ImageSelector class which should be comfy independent and easily testable too full_path = os.path.expanduser(directory) diff --git a/utils/tensor_utils.py b/utils/tensor_utils.py index 79f211f..f669430 100644 --- a/utils/tensor_utils.py +++ b/utils/tensor_utils.py @@ -2,7 +2,6 @@ import numpy as np from torch import Tensor import torch -from torchvision.transforms import ToTensor from PIL import Image """