main
黄海 1 year ago
parent 458d01c15b
commit 521503e9b5

@ -11,7 +11,7 @@ server_address = 192.168.1.21:8188
[webui] [webui]
; 生图服务地址 ; 生图服务地址
webui_server = http://192.168.1.21:7860 webui_address = 192.168.1.21:7860
txt2img_url = /sdapi/v1/txt2img txt2img_url = /sdapi/v1/txt2img
img2img_url = /sdapi/v1/img2img img2img_url = /sdapi/v1/img2img
; WEB服务器地址 ; WEB服务器地址

@ -101,7 +101,7 @@ def runComfyUI(model_id, json_data, input_image, target_folder):
img = [] img = []
for x in input_image: for x in input_image:
with open(x, "rb") as f: with open(x, "rb") as f:
y = upload_file(server_address, f, "", True) y = upload_file(comfyui_address, f, "", True)
img.append(y) img.append(y)
# 如果存在多个姿势图和风格图那么在配置文件中写死比如pose=post_1.jpg style=style_1.jpg # 如果存在多个姿势图和风格图那么在配置文件中写死比如pose=post_1.jpg style=style_1.jpg
# 同时由于ComfyUI需要把这个文件上传到服务器所以需要在json文件中指定哪个文件需要上传 # 同时由于ComfyUI需要把这个文件上传到服务器所以需要在json文件中指定哪个文件需要上传
@ -116,7 +116,7 @@ def runComfyUI(model_id, json_data, input_image, target_folder):
if value['inputs']['filename_prefix'] == 'ComfyUI': if value['inputs']['filename_prefix'] == 'ComfyUI':
myfilter.append(key) myfilter.append(key)
# 生成 # 生成
files = generate_clip(server_address, json_data, client_id, target_folder, myfilter) files = generate_clip(comfyui_address, json_data, client_id, target_folder, myfilter)
# 上传到云存储,回写数据接口 # 上传到云存储,回写数据接口
for file in files: for file in files:
@ -156,7 +156,7 @@ def fill_input(prompt_data, file_array):
key = x['key'] key = x['key']
value = x['value'] value = x['value']
with open(value, "rb") as f: with open(value, "rb") as f:
y = upload_file(server_address, f, "", True) y = upload_file(comfyui_address, f, "", True)
# 需要 # 需要
array = key.split(",") array = key.split(",")
prompt_data[array[0]][array[1]][array[2]] = y prompt_data[array[0]][array[1]][array[2]] = y
@ -287,17 +287,17 @@ if __name__ == '__main__':
machine_id = config['system']['machine_id'] machine_id = config['system']['machine_id']
# webui 服务器地址 # webui 服务器地址
webui_server = config['webui']['webui_server'] webui_address = 'http://' + config['webui']['webui_address']
# 文生图服务地址 # 文生图服务地址
txt2img_url = webui_server + config['webui']['txt2img_url'] txt2img_url = webui_address + config['webui']['txt2img_url']
# 图生图服务地址 # 图生图服务地址
img2img_url = webui_server + config['webui']['img2img_url'] img2img_url = webui_address + config['webui']['img2img_url']
# WEB服务器地址 # WEB服务器地址
web_url = config['webServer']['web_url'] web_url = config['webServer']['web_url']
# COMFYUI服务器地址 # COMFYUI服务器地址
server_address = config.get('comfyui', 'server_address') comfyui_address = config.get('comfyui', 'server_address')
while True: while True:
try: try:
@ -314,11 +314,12 @@ if __name__ == '__main__':
finish_task(v_task_id, v_target_img_urls) finish_task(v_task_id, v_target_img_urls)
# 清理SD缓存 # 清理SD缓存
clear_webui_cache(server_address) clear_webui_cache(webui_address)
get_webui_used(server_address) get_webui_used(webui_address)
# 清理GPU缓存 # 清理GPU缓存
clear_comfyui_cache(server_address) clear_comfyui_cache(comfyui_address)
get_comfyui_used(server_address) get_comfyui_used(comfyui_address)
elif v_task_id == 0: elif v_task_id == 0:
# 本轮没有任务 # 本轮没有任务

Loading…
Cancel
Save