From 17af74295c54f00703323902193799dc56eef603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Tue, 2 Jul 2024 10:28:22 +0800 Subject: [PATCH] 'commit' --- BaiHu/doTask.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/BaiHu/doTask.py b/BaiHu/doTask.py index 6709b4c3..e670d7c8 100644 --- a/BaiHu/doTask.py +++ b/BaiHu/doTask.py @@ -1,6 +1,5 @@ import os import os.path -import shutil from urllib.parse import urlparse from Util import ConfigUtil @@ -109,7 +108,13 @@ def runComfyUI(model_id, json_data, input_image, target_folder): # 填充输入 json_data = fill_input(json_data, img) # 过滤器,哪些返回节点中获取到的图片是有用的 - myfilter = getMyFilter(json_data) + myfilter = [] + # 遍历prompt_data中的所有节点 + for key, value in json_data.items(): + if 'inputs' in value: + if 'filename_prefix' in value['inputs']: + if value['inputs']['filename_prefix'] == 'ComfyUI': + myfilter.append(key) # 生成 files = generate_clip(server_address, json_data, client_id, target_folder, myfilter) @@ -123,16 +128,6 @@ def runComfyUI(model_id, json_data, input_image, target_folder): def download_image(image_url, file_path): os.system('./Tools/wget ' + image_url + ' -O ' + file_path) -def getMyFilter(prompt_data): - myfilter = [] - # 遍历prompt_data中的所有节点 - for key, value in prompt_data.items(): - if 'inputs' in value: - if 'filename_prefix' in value['inputs']: - if value['inputs']['filename_prefix'] == 'ComfyUI': - myfilter.append(key) - return myfilter - # 根据输入的图片集合,填充到 def fill_input(prompt_data, file_array): @@ -165,7 +160,7 @@ def fill_input(prompt_data, file_array): # 需要 array = key.split(",") prompt_data[array[0]][array[1]][array[2]] = y - # + # 删除多余的配置节 if "style_pose_images" in prompt_data: del prompt_data["style_pose_images"]