Skip to content

Commit

Permalink
add node's description, node ListUnWrapper and some workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
刘雪峰 committed Sep 19, 2024
1 parent c9a56d3 commit d8747cc
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 3 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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节点的列表版本 |
Expand All @@ -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相关节点

Expand Down Expand Up @@ -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)
Expand Down
Binary file added docs/settings_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions easyapi/BboxNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions easyapi/DetectNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
26 changes: 26 additions & 0 deletions easyapi/UtilNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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",
}
Binary file added example/example_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/example_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down

0 comments on commit d8747cc

Please sign in to comment.