main
黄海 1 year ago
parent a5c3bc42be
commit 17af74295c

@ -1,6 +1,5 @@
import os import os
import os.path import os.path
import shutil
from urllib.parse import urlparse from urllib.parse import urlparse
from Util import ConfigUtil 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) 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) 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): def download_image(image_url, file_path):
os.system('./Tools/wget ' + image_url + ' -O ' + 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): def fill_input(prompt_data, file_array):
@ -165,7 +160,7 @@ def fill_input(prompt_data, file_array):
# 需要 # 需要
array = key.split(",") array = key.split(",")
prompt_data[array[0]][array[1]][array[2]] = y prompt_data[array[0]][array[1]][array[2]] = y
# # 删除多余的配置节
if "style_pose_images" in prompt_data: if "style_pose_images" in prompt_data:
del prompt_data["style_pose_images"] del prompt_data["style_pose_images"]

Loading…
Cancel
Save