save code

This commit is contained in:
colomi
2025-07-21 21:55:06 +08:00
parent c37e0e473d
commit e53e65b6f4
4 changed files with 116 additions and 33 deletions
+9 -1
View File
@@ -96,6 +96,11 @@
<input type="file" id="clothInput" accept="image/*">
<img id="clothPreview" class="image-preview" alt="衣服图片预览">
</div>
<div class="option-box">
<label>
<input type="checkbox" id="no2Checkbox"> 设置 no2 不要两步(一步完成)
</label>
</div>
</div>
<button id="submitBtn">提交处理</button>
@@ -139,6 +144,7 @@
document.getElementById('submitBtn').addEventListener('click', function() {
const humanFile = document.getElementById('humanInput').files[0];
const clothFile = document.getElementById('clothInput').files[0];
const no2 = document.getElementById("no2Checkbox").checked;
if (!humanFile || !clothFile) {
alert('请同时选择人体图片和衣服图片!');
@@ -159,7 +165,7 @@
human_img: humanDataURL, // 包含完整前缀的Base64
cloth_img: clothDataURL, // 包含完整前缀的Base64
output_format: "url",
is_generated: false,
no2: no2,
};
console.log("准备发送的数据:", data); // 调试用
@@ -190,6 +196,8 @@
<p>处理成功!点击查看结果:</p>
<a href="${data.url}" target="_blank">${data.url}</a>
<p><img src="${data.url}" style="max-width: 100%; margin-top: 10px;"></p>
<a href="${data.first_url}" target="_blank">${data.url}</a>
<p><img src="${data.first_url}" style="max-width: 100%; margin-top: 10px;"></p>
`;
} else {
resultDiv.innerHTML = `