diff --git a/README.md b/README.md index a854bc2..1bf0f33 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ | ImageEqual | 图片是否相等(可用于通过判断遮罩图是否全黑来判定是否有遮罩) | | SDBaseVerNumber | 判断SD大模型版本是1.5还是xl | | ListWrapper | 包装成列表(任意类型) | +| ListUnWrapper | 转成输出列表,后面连接的节点会把每个元素执行一遍,实现类似遍历效果 | | BboxToCropData | bbox转cropData,方便接入was节点使用 | | BboxToBbox | bbox两种格式(x,y,w,h)和(x1,y1,x2,y2)的相互转换 | | BboxesToBboxes | BboxToBbox节点的列表版本 | @@ -56,11 +57,18 @@ Tips: base64格式字符串比较长,会导致界面卡顿,接口请求带宽可能也会有瓶颈,条件允许可以把图片上传到OSS服务器得到URL,然后用LoadImageFromUrl加载,由于无相关OSS账号,上传OSS节点需自行编写,暂不支持。 -### [示例](example/example.png) +### 示例 ![save api extended](docs/example_note.png) +### [工作流](example/example.png) + ![save api extended](example/example.png) ![save api extended](example/example_1.png) + ![save api extended](example/example_2.png) + ![save api extended](example/example_3.png) ## 更新记录 +### 2024-09-19 +- 添加ListUnWrapper节点 + ### 2024-09-04 - 添加一些bbox相关节点 @@ -100,7 +108,8 @@ Tips: base64格式字符串比较长,会导致界面卡顿,接口请求带 - 使用镜像地址(模型自动下载问题) - 配置路径:Settings -> [EasyApi] Huggingface Mirror - 配置路径:Settings -> [EasyApi] RawGithub Mirror - + - 配置路径:Settings -> [EasyApi] Github Mirror + ![save api extended](docs/settings_1.png) - 菜单扩展 - 重设某个节点的id(Node Context Menu) diff --git a/docs/settings_1.png b/docs/settings_1.png new file mode 100644 index 0000000..bd37b8c Binary files /dev/null and b/docs/settings_1.png differ diff --git a/easyapi/BboxNode.py b/easyapi/BboxNode.py index 01403e7..9ca258d 100644 --- a/easyapi/BboxNode.py +++ b/easyapi/BboxNode.py @@ -234,6 +234,7 @@ def INPUT_TYPES(cls): RETURN_NAMES = ("crop_image", "mask", "crop_bbox") FUNCTION = "crop" CATEGORY = "EasyApi/Bbox" + DESCRIPTION = "根据bbox区域裁剪图片。 bbox的格式是左上角和右下角坐标: [x,y,x1,y1]" def crop(self, image: torch.Tensor, bbox, margin): x, y, x1, y1 = bbox diff --git a/easyapi/DetectNode.py b/easyapi/DetectNode.py index 1ab28ee..e00ebc2 100644 --- a/easyapi/DetectNode.py +++ b/easyapi/DetectNode.py @@ -40,6 +40,7 @@ def INPUT_TYPES(self): # INPUT_IS_LIST = False # OUTPUT_IS_LIST = (False, False) + DESCRIPTION = "检测图片中的人脸,bbox是一个包含所有人脸的json字符串,格式是每个人脸区域的左上角和右下角角坐标: [[x1_1,y1_1,x1_2,y1_2],[x2_1,y2_1,x2_2,y2_2],...]" def detect(self, image, shape, shape_color, show_num, num_color='#FF0000', num_pos=None, num_sort=None, INSIGHTFACE=None): diff --git a/easyapi/UtilNode.py b/easyapi/UtilNode.py index 69ac38a..aa96e48 100644 --- a/easyapi/UtilNode.py +++ b/easyapi/UtilNode.py @@ -395,6 +395,30 @@ def to_list(self, any_1, any_2=None): return ([any_1, any_2],) +class ListUnWrapper: + @classmethod + def INPUT_TYPES(self): + return {"required": { + "lst": (any_type, {}), + }, + } + + RETURN_TYPES = (any_type,) + # RETURN_NAMES = ("STRING", ) + + FUNCTION = "unwrapper" + + OUTPUT_NODE = False + CATEGORY = "EasyApi/List" + + # INPUT_IS_LIST = False + OUTPUT_IS_LIST = (True, False) + DESCRIPTION = "输出的是一个个的元素,相当于执行多次后面连接的那个节点,配合ListWrapper可以实现预览不同尺寸的图像" + + def unwrapper(self, lst): + return (lst,) + + NODE_CLASS_MAPPINGS = { "GetImageBatchSize": GetImageBatchSize, "JoinList": JoinList, @@ -411,6 +435,7 @@ def to_list(self, any_1, any_2=None): "ImageEqual": ImageEqual, "SDBaseVerNumber": SDBaseVerNumber, "ListWrapper": ListWrapper, + "ListUnWrapper": ListUnWrapper, } # A dictionary that contains the friendly/humanly readable titles for the nodes @@ -430,4 +455,5 @@ def to_list(self, any_1, any_2=None): "ImageEqual": "Image Equal Judgment", "SDBaseVerNumber": "SD Base Version Number", "ListWrapper": "ListWrapper", + "ListUnWrapper": "ListUnWrapper", } diff --git a/example/example_2.png b/example/example_2.png new file mode 100644 index 0000000..8ef01b0 Binary files /dev/null and b/example/example_2.png differ diff --git a/example/example_3.png b/example/example_3.png new file mode 100644 index 0000000..0fd2e3c Binary files /dev/null and b/example/example_3.png differ diff --git a/pyproject.toml b/pyproject.toml index 998f613..680d885 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-easyapi-nodes" description = "Provides some features and nodes related to API calls." -version = "1.0.2" +version = "1.0.3" license = { file = "LICENSE" } dependencies = ["segment_anything", "simple_lama_inpainting", "insightface"]