save code

This commit is contained in:
xsl
2025-10-02 16:47:05 +08:00
parent af30bcc97c
commit 20e6b294f1
+8 -3
View File
@@ -540,7 +540,10 @@ def process_change_cloth(human_filename, cloth_filename, output_format, img_url,
if no2:
out_human_https_url = human_url
else:
out_human_image = Image.open(f'{APP_ROOT}/../output/{out_human_name}')
if os.path.exists(f'{APP_ROOT}/../output/{out_human_name}'):
out_human_image = Image.open(f'{APP_ROOT}/../output/{out_human_name}')
else:
out_human_image = Image.open(f'{APP_ROOT}/../input/{out_human_name}')
out_human_jpg_name = out_human_name.replace(".png", ".jpg")
out_human_jpg_path_name = f'{APP_ROOT}/static/imgs/{out_human_jpg_name}'
out_human_image.save(out_human_jpg_path_name, quality=90)
@@ -648,8 +651,10 @@ def do_change_cloth():
tuodi = data['tuodi']
print(f"tuodi:{tuodi}")
kuzi = data['kuzi']
print(f"kuzi:{kuzi}")
kuzi = False
if 'kuzi' in data:
kuzi = data['kuzi']
print(f"kuzi:{kuzi}")
try:
return process_change_cloth(human_filename, cloth_filename, output_format, cloth_url, human_url, no2, tuodi, kuzi)