From 34c2134bf86055ca45111288c8349ea1a784b85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Sat, 29 Jun 2024 07:24:03 +0800 Subject: [PATCH] 'commit' --- BaiHu/JSON/22_1.json | 11 +++++++++-- BaiHu/JSON/22_2.json | 11 +++++++++-- BaiHu/JSON/22_3.json | 11 +++++++++-- BaiHu/JSON/22_4.json | 11 +++++++++-- BaiHu/JSON/22_5.json | 11 +++++++++-- BaiHu/doTask.py | 20 +++++++++++++++++++- 6 files changed, 64 insertions(+), 11 deletions(-) diff --git a/BaiHu/JSON/22_1.json b/BaiHu/JSON/22_1.json index 198da0be..bf06f8e5 100644 --- a/BaiHu/JSON/22_1.json +++ b/BaiHu/JSON/22_1.json @@ -1,4 +1,11 @@ { + "source_images": [ + "49,inputs,image" + ], + "other_images": [ + "./Image/C22/pose_1.png", + "./Image/C22/style_1.png" + ], "3": { "inputs": { "ckpt_name": "xxmix9realistic_v40.safetensors", @@ -204,7 +211,7 @@ }, "98": { "inputs": { - "image": "image (93).png", + "image": "style_1.png", "upload": "image" }, "class_type": "LoadImage", @@ -242,7 +249,7 @@ }, "118": { "inputs": { - "image": "pose-456x576-2 (1).jpg", + "image": "pose_1.png", "upload": "image" }, "class_type": "LoadImage", diff --git a/BaiHu/JSON/22_2.json b/BaiHu/JSON/22_2.json index 198da0be..a4ceca74 100644 --- a/BaiHu/JSON/22_2.json +++ b/BaiHu/JSON/22_2.json @@ -1,4 +1,11 @@ { + "source_images": [ + "49,inputs,image" + ], + "other_images": [ + "./Image/C22/pose_2.png", + "./Image/C22/style_2.png" + ], "3": { "inputs": { "ckpt_name": "xxmix9realistic_v40.safetensors", @@ -204,7 +211,7 @@ }, "98": { "inputs": { - "image": "image (93).png", + "image": "style_2.png", "upload": "image" }, "class_type": "LoadImage", @@ -242,7 +249,7 @@ }, "118": { "inputs": { - "image": "pose-456x576-2 (1).jpg", + "image": "pose_2.png", "upload": "image" }, "class_type": "LoadImage", diff --git a/BaiHu/JSON/22_3.json b/BaiHu/JSON/22_3.json index 198da0be..9e7b057b 100644 --- a/BaiHu/JSON/22_3.json +++ b/BaiHu/JSON/22_3.json @@ -1,4 +1,11 @@ { + "source_images": [ + "49,inputs,image" + ], + "other_images": [ + "./Image/C22/pose_3.png", + "./Image/C22/style_3.png" + ], "3": { "inputs": { "ckpt_name": "xxmix9realistic_v40.safetensors", @@ -204,7 +211,7 @@ }, "98": { "inputs": { - "image": "image (93).png", + "image": "style_3.png", "upload": "image" }, "class_type": "LoadImage", @@ -242,7 +249,7 @@ }, "118": { "inputs": { - "image": "pose-456x576-2 (1).jpg", + "image": "pose_3.png", "upload": "image" }, "class_type": "LoadImage", diff --git a/BaiHu/JSON/22_4.json b/BaiHu/JSON/22_4.json index 198da0be..0adff56f 100644 --- a/BaiHu/JSON/22_4.json +++ b/BaiHu/JSON/22_4.json @@ -1,4 +1,11 @@ { + "source_images": [ + "49,inputs,image" + ], + "other_images": [ + "./Image/C22/pose_4.png", + "./Image/C22/style_4.png" + ], "3": { "inputs": { "ckpt_name": "xxmix9realistic_v40.safetensors", @@ -204,7 +211,7 @@ }, "98": { "inputs": { - "image": "image (93).png", + "image": "style_4.png", "upload": "image" }, "class_type": "LoadImage", @@ -242,7 +249,7 @@ }, "118": { "inputs": { - "image": "pose-456x576-2 (1).jpg", + "image": "pose_4.png", "upload": "image" }, "class_type": "LoadImage", diff --git a/BaiHu/JSON/22_5.json b/BaiHu/JSON/22_5.json index 198da0be..05f73e3d 100644 --- a/BaiHu/JSON/22_5.json +++ b/BaiHu/JSON/22_5.json @@ -1,4 +1,11 @@ { + "source_images": [ + "49,inputs,image" + ], + "other_images": [ + "./Image/C22/pose_1.png", + "./Image/C22/style_2.png" + ], "3": { "inputs": { "ckpt_name": "xxmix9realistic_v40.safetensors", @@ -204,7 +211,7 @@ }, "98": { "inputs": { - "image": "image (93).png", + "image": "style_2.png", "upload": "image" }, "class_type": "LoadImage", @@ -242,7 +249,7 @@ }, "118": { "inputs": { - "image": "pose-456x576-2 (1).jpg", + "image": "pose_1.png", "upload": "image" }, "class_type": "LoadImage", diff --git a/BaiHu/doTask.py b/BaiHu/doTask.py index 5e332d9e..0dfb3897 100644 --- a/BaiHu/doTask.py +++ b/BaiHu/doTask.py @@ -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) # 过滤器,哪些返回节点中获取到的图片是有用的