Workflow ComfyUi - Create a Hugging and Kissing Video from a Photo
详情
下载文件
模型描述
该模型是一个工作流,当提供两个人的图片时,可以让两人“相拥”。该模型是通过修复T8star-Aix在Runninghub上发布的、存在故障的工作流而创建的。
如果被要求移除,我将立即移除。
更改内容在视频中展示,包括替换图像裁剪节点,并且代码中修复了以下错误:
2025-03-28T08:24:10.310732 - Traceback (most recent call last):
File "/ComfyUI/execution.py", line 327, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/ComfyUI/execution.py", line 202, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/ComfyUI/execution.py", line 174, in _map_node_over_list
process_inputs(input_dict, i)
File "/ComfyUI/execution.py", line 163, in process_inputs
results.append(getattr(obj, func)(**inputs))
File "/ComfyUI/custom_nodes/comfyui_ttp_toolset/TTP_toolsets.py", line 704, in expand_and_mask
fill_rgba = self.hex_to_rgba(fill_color)
File "/ComfyUI/custom_nodes/comfyui_ttp_toolset/TTP_toolsets.py", line 559, in hex_to_rgba
raise ValueError("Invalid hex color format")
ValueError: Invalid hex color format
2025-03-28T08:24:10.310997 - Prompt executed in 8.00 seconds
此错误的解决方案:
检查 expand_and_mask 函数被调用的位置:
在 TTP_toolsets.py 的第 704 行定义 fill_color 变量。
验证其是否为无效的 HEX 颜色代码:
HEX 颜色代码通常应为 #RRGGBB 或 #RRGGBBAA 格式(例如:#FF5733 或 #FF5733FF)。
若 fill_color 格式错误(如 #FF573、123456、red 等),就会出现此错误。
在 hex_to_rgba 函数中验证 HEX 格式:
更新 TTP_toolsets.py 第 559 行的 hex_to_rgba 函数:
例如,可添加如下正则表达式检查:
将代码修改为:
import re
def hex_to_rgba(self, hex_color):
# 若存在 '#',则移除开头的 '#'
hex_color = hex_color.lstrip('#')
# 检查 HEX 格式是否有效
if not re.match(r'^[A-Fa-f0-9]{6}$|^[A-Fa-f0-9]{8}$', hex_color):
raise ValueError(f"Invalid hex color format: {hex_color}. Expected format is #RRGGBB or #RRGGBBAA.")
# 若为6位字符,则返回默认Alpha值255(完全不透明)
if len(hex_color) == 6:
r = int(hex_color[0:2], 16)
g = int(hex_color[2:4], 16)
b = int(hex_color[4:6], 16)
return (r, g, b, 255)
# 若为8位字符,最后两位为Alpha(透明度)值
elif len(hex_color) == 8:
r = int(hex_color[0:2], 16)
g = int(hex_color[2:4], 16)
b = int(hex_color[4:6], 16)
a = int(hex_color[6:8], 16)
return (r, g, b, a)
else:
raise ValueError(f"Invalid hex color format: {hex_color}")