main
黄海 12 months ago
parent 7667004290
commit 1616adedc6

@ -83,9 +83,14 @@ def get_image_base64_str(image_path):
# 文生图完成一个极小的图片创建防止img_2_img暴显存
def txt_2_img_blank(webui_address):
txt2img_url = 'http://' + webui_address + '/sdapi/v1/txt2img'
data = {'prompt': 'a dog', 'negative_prompt': '', 'seed': -1, 'steps': 1, 'width': 1, 'height': 1, 'cfg_scale': 1}
data = {"prompt": "a dog", "negative_prompt": "", "seed": -1, "steps": 1, "width": 1, "height": 1, "cfg_scale": 1,
"override_settings": {
"sd_model_checkpoint": "majicMix sombre 麦橘唯美_v2.0.safetensors [796bc0cc14]",
"sd_vae": "Automatic"
}}
submit_post(txt2img_url, data)
# 将图片一切为四
def split_4_image(image_path, out_path):
res = []

@ -212,10 +212,9 @@ def restart_server(webui_address):
# 清理一下SD
def release_sd(webui_address, comfyui_address):
pass
# comfyui的显存先清理一下
# clear_comfyui_cache(comfyui_address)
clear_comfyui_cache(comfyui_address)
# 文生图一下据测试在img_2_img报错暴显存的时候需要先清一下显存
# txt_2_img_blank(webui_address)
txt_2_img_blank(webui_address)
# 清理一下缓存
# clear_webui_cache(webui_address)
clear_webui_cache(webui_address)

@ -85,7 +85,6 @@ def webui_img_2_img(model_id, prompt_id, json_data, input_image, target_folder):
printf("开始生成图片...")
# 调用生图服务
response = submit_post(img2img_url, json_data)
#print(response.text)
# 创建文件的完整路径
file_path = os.path.join(target_folder, str(uuid.uuid4()) + '.png')
save_encoded_image(response.json()['images'][0], file_path)

Loading…
Cancel
Save