save code

This commit is contained in:
colomi
2025-07-14 23:21:16 +08:00
parent aa5fc8cbf1
commit 3b43831211
3 changed files with 17 additions and 2 deletions
+13
View File
@@ -220,6 +220,12 @@ def change_cloth_base64():
if not data: if not data:
return jsonify({"ret":-1,'msg': 'No JSON data provided'}), 400 return jsonify({"ret":-1,'msg': 'No JSON data provided'}), 400
is_generated = data.get("is_generated")
if not is_generated:
return jsonify({"error": "Missing 'is_generated' parameter"}), 400
print(f"is_generated: {is_generated}")
human_img = data.get('human_img') human_img = data.get('human_img')
cloth_img = data.get('cloth_img') cloth_img = data.get('cloth_img')
output_format = data.get('output_format') output_format = data.get('output_format')
@@ -285,6 +291,13 @@ def save_image_from_url(image_url):
def change_cloth(): def change_cloth():
"""从 URL 下载图片""" """从 URL 下载图片"""
data = request.json data = request.json
is_generated = data.get("is_generated")
if not is_generated:
return jsonify({"error": "Missing 'is_generated' parameter"}), 400
print(f"is_generated: {is_generated}")
human_url = data.get("human_url") human_url = data.get("human_url")
if not human_url: if not human_url:
+2 -1
View File
@@ -158,7 +158,8 @@
const data = { const data = {
human_img: humanDataURL, // 包含完整前缀的Base64 human_img: humanDataURL, // 包含完整前缀的Base64
cloth_img: clothDataURL, // 包含完整前缀的Base64 cloth_img: clothDataURL, // 包含完整前缀的Base64
output_format: "url" output_format: "url",
is_generated: true,
}; };
console.log("准备发送的数据:", data); // 调试用 console.log("准备发送的数据:", data); // 调试用
+2 -1
View File
@@ -144,7 +144,8 @@
body: JSON.stringify({ body: JSON.stringify({
human_url: humanUrl, human_url: humanUrl,
cloth_url: clothUrl, cloth_url: clothUrl,
output_format: 'url' output_format: 'url',
is_generated: true
}) })
}); });