|
|
|
@ -148,6 +148,15 @@ def getMyFilter(prompt_data):
|
|
|
|
|
|
|
|
|
|
# 根据输入的图片集合,填充到
|
|
|
|
|
def fill_input(prompt_data, file_array):
|
|
|
|
|
'''
|
|
|
|
|
样例:
|
|
|
|
|
"source_images": [
|
|
|
|
|
"22,inputs,image"
|
|
|
|
|
],
|
|
|
|
|
prompt_data["98"]["inputs"]["image"] = image_pose
|
|
|
|
|
# 原图
|
|
|
|
|
prompt_data["49"]["inputs"]["image"] = img[0]
|
|
|
|
|
'''
|
|
|
|
|
# 是不是不存在配置节
|
|
|
|
|
if "source_images" not in prompt_data:
|
|
|
|
|
print("配置文件不包含source_images配置节,程序无法继续!")
|
|
|
|
@ -167,6 +176,14 @@ def fill_input(prompt_data, file_array):
|
|
|
|
|
if "source_images" in prompt_data:
|
|
|
|
|
del prompt_data["source_images"]
|
|
|
|
|
|
|
|
|
|
if 'other_images' in prompt_data:
|
|
|
|
|
for x in prompt_data['other_images']:
|
|
|
|
|
with open(x, "rb") as f:
|
|
|
|
|
y = upload_file(server_address, f, "", True)
|
|
|
|
|
|
|
|
|
|
if "other_images" in prompt_data:
|
|
|
|
|
del prompt_data["other_images"]
|
|
|
|
|
|
|
|
|
|
return prompt_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -180,7 +197,8 @@ def runComfyUI(model_id, json_data, input_image, target_folder):
|
|
|
|
|
with open(x, "rb") as f:
|
|
|
|
|
y = upload_file(server_address, f, "", True)
|
|
|
|
|
img.append(y)
|
|
|
|
|
|
|
|
|
|
# 如果存在多个姿势图和风格图,那么在配置文件中写死,比如pose=post_1.jpg style=style_1.jpg
|
|
|
|
|
# 同时,由于ComfyUI需要把这个文件上传到服务器,所以,需要在json文件中指定哪个文件需要上传
|
|
|
|
|
# 填充输入
|
|
|
|
|
json_data = fill_input(json_data, img)
|
|
|
|
|
# 过滤器,哪些返回节点中获取到的图片是有用的
|
|
|
|
|