diff --git a/http_app.py b/http_app.py index 267424a..e2bc6d1 100644 --- a/http_app.py +++ b/http_app.py @@ -220,6 +220,12 @@ def change_cloth_base64(): if not data: 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') cloth_img = data.get('cloth_img') output_format = data.get('output_format') @@ -285,6 +291,13 @@ def save_image_from_url(image_url): def change_cloth(): """从 URL 下载图片""" 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") if not human_url: diff --git a/static/index.html b/static/index.html index 0914a7f..29093c4 100644 --- a/static/index.html +++ b/static/index.html @@ -158,7 +158,8 @@ const data = { human_img: humanDataURL, // 包含完整前缀的Base64 cloth_img: clothDataURL, // 包含完整前缀的Base64 - output_format: "url" + output_format: "url", + is_generated: true, }; console.log("准备发送的数据:", data); // 调试用 diff --git a/static/index_url.html b/static/index_url.html index 2783e4c..a6db7fe 100644 --- a/static/index_url.html +++ b/static/index_url.html @@ -144,7 +144,8 @@ body: JSON.stringify({ human_url: humanUrl, cloth_url: clothUrl, - output_format: 'url' + output_format: 'url', + is_generated: true }) });