From 8821883f63c5f1a4fb39e5f6acab5b810c05290f Mon Sep 17 00:00:00 2001 From: chflame163 Date: Fri, 23 Aug 2024 20:42:30 +0800 Subject: [PATCH] NumberCalculatorV2 and NumberCalculator add min and max method. --- README.MD | 1 + README_CN.MD | 1 + py/data_nodes.py | 14 ++++++++++++-- pyproject.toml | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.MD b/README.MD index 24e1e49..43d8140 100644 --- a/README.MD +++ b/README.MD @@ -102,6 +102,7 @@ When this error has occurred, please check the network environment. ## Update **If the dependency package error after updating, please reinstall the relevant dependency packages.
+* [NumberCalculatorV2](#NumberCalculatorV2) and [NumberCalculator](#NumberCalculator) add the ```min``` and ```max``` method. * Optimize node loading speed. * [Florence2Image2Prompt](#Florence2Image2Prompt) add support for ```thwri/CogFlorence-2-Large-Freeze``` and ```thwri/CogFlorence-2.1-Large``` models. Please download the model files from [BaiduNetdisk](https://pan.baidu.com/s/1hzw9-QiU1vB8pMbBgofZIA?pwd=mfl3) or [huggingface/CogFlorence-2-Large-Freeze](https://huggingface.co/thwri/CogFlorence-2-Large-Freeze/tree/main) and [huggingface/CogFlorence-2.1-Large](https://huggingface.co/thwri/CogFlorence-2.1-Large/tree/main) , then copy it to ```ComfyUI/models/florence2``` folder. * Merge branch from [ClownsharkBatwing](https://github.com/ClownsharkBatwing) "Use GPU for color blend mode", the speed of some layer blends by more than ten times. diff --git a/README_CN.MD b/README_CN.MD index b6b61c2..5ef9aa7 100644 --- a/README_CN.MD +++ b/README_CN.MD @@ -103,6 +103,7 @@ git clone https://github.com/chflame163/ComfyUI_LayerStyle.git ## 更新说明 **如果本插件更新后出现依赖包错误,请重新安装相关依赖包。 +* [NumberCalculatorV2](#NumberCalculatorV2) 和 [NumberCalculator](#NumberCalculator) 节点增加 ```min``` 和 ```max``` 方法。 * 优化节点加载速度。 * [Florence2Image2Prompt](#Florence2Image2Prompt) 增加thwri/CogFlorence-2-Large-Freeze 和 thwri/CogFlorence-2.1-Large 模型支持。请从[百度网盘](https://pan.baidu.com/s/1hzw9-QiU1vB8pMbBgofZIA?pwd=mfl3) 或 [huggingface/CogFlorence-2-Large-Freeze](https://huggingface.co/thwri/CogFlorence-2-Large-Freeze/tree/main) 和 [huggingface/CogFlorence-2.1-Large](https://huggingface.co/thwri/CogFlorence-2.1-Large/tree/main) 下载模型文件并复制到```ComfyUI/models/florence2```文件夹。 * 合并来自[ClownsharkBatwing](https://github.com/ClownsharkBatwing)的分支“使用GPU进行颜色混合模式”,某些图层的混合速度提高了十倍以上。 diff --git a/py/data_nodes.py b/py/data_nodes.py index 2c8de6b..3bd2e98 100644 --- a/py/data_nodes.py +++ b/py/data_nodes.py @@ -143,7 +143,7 @@ class NumberCalculator: pass @classmethod def INPUT_TYPES(self): - operator_list = ["+", "-", "*", "/", "**", "//", "%" ] + operator_list = ["+", "-", "*", "/", "**", "//", "%", "nth_root", "min", "max"] return {"required": { "a": (any, {}), "b": (any, {}), @@ -167,6 +167,12 @@ class NumberCalculator: ret_value = a ** b if operator == "%": ret_value = a % b + if operator == "nth_root": + ret_value = a ** (1/b) + if operator == "min": + ret_value = min(a, b) + if operator == "max": + ret_value = max(a, b) if operator == "/": if b != 0: ret_value = a / b @@ -185,7 +191,7 @@ class NumberCalculatorV2: pass @classmethod def INPUT_TYPES(self): - operator_list = ["+", "-", "*", "/", "**", "//", "%" , "nth_root"] + operator_list = ["+", "-", "*", "/", "**", "//", "%" , "nth_root", "min", "max"] return { "required": @@ -239,6 +245,10 @@ class NumberCalculatorV2: ret_value = a % b if operator == "nth_root": ret_value = a ** (1/b) + if operator == "min": + ret_value = min(a, b) + if operator == "max": + ret_value = max(a, b) if operator == "/": if b != 0: ret_value = a / b diff --git a/pyproject.toml b/pyproject.toml index d5b7f58..4087a73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_layerstyle" description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress." -version = "1.0.26" +version = "1.0.27" license = "MIT" dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "psd-tools"]