|
|
|
@ -25,7 +25,7 @@ def upload_img_file(file_path, model_id):
|
|
|
|
|
return url
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 文生图服务调用
|
|
|
|
|
# 1、文生图服务调用
|
|
|
|
|
def webui_txt_2_img(model_id, json_data, input_image, target_folder):
|
|
|
|
|
# 提示词
|
|
|
|
|
prompt = json_data['prompt']
|
|
|
|
@ -59,7 +59,7 @@ def webui_txt_2_img(model_id, json_data, input_image, target_folder):
|
|
|
|
|
res.append(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 图生图服务调用
|
|
|
|
|
# 2、图生图服务调用
|
|
|
|
|
def webui_img_2_img(model_id, prompt_id, json_data, input_image, target_folder):
|
|
|
|
|
source_img = encode_image(input_image[0])
|
|
|
|
|
# 模型固定的参考图片
|
|
|
|
@ -96,7 +96,7 @@ def webui_img_2_img(model_id, prompt_id, json_data, input_image, target_folder):
|
|
|
|
|
res.append(url) # 添加到结果集合中
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ComfyUI服务调用
|
|
|
|
|
# 3、ComfyUI服务调用
|
|
|
|
|
def runComfyUI(model_id, json_data, input_image, target_folder):
|
|
|
|
|
# 生成一个唯一的客户端ID
|
|
|
|
|
client_id = str(uuid.uuid4())
|
|
|
|
@ -129,7 +129,7 @@ def runComfyUI(model_id, json_data, input_image, target_folder):
|
|
|
|
|
res.append(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 风格转绘
|
|
|
|
|
# 4、风格转绘
|
|
|
|
|
def webui_convert(model_id, json_data, input_image, target_folder):
|
|
|
|
|
# 1、需要反推提示词
|
|
|
|
|
prompt = get_wd_14(wd_url, input_image[0])
|
|
|
|
@ -361,9 +361,7 @@ if __name__ == '__main__':
|
|
|
|
|
# COMFYUI服务器地址
|
|
|
|
|
comfyui_address = config.get('comfyui', 'server_address')
|
|
|
|
|
# 反推接口地址
|
|
|
|
|
wd_url = 'http://' + webui_address + '/tagger/v1/interrogate'
|
|
|
|
|
# image_path = r'D:\KeCheng\BaiHu\Backup\mote2.png'
|
|
|
|
|
# print(get_wd_14(wd_url, image_path))
|
|
|
|
|
wd_url = 'http://' + webui_address + config['webui']['wd_url']
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
try:
|
|
|
|
|