From c15a3c2e1588d7b3ec51384e98658c3858e40f23 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 17 Jun 2026 23:04:49 +0800 Subject: [PATCH] save code --- app.py | 2 +- docs/接口文档.md | 2 +- static/test_interface2.html | 8 ++++ static/test_interface3.html | 91 ++++++++++++++++++++++++++----------- 4 files changed, 75 insertions(+), 28 deletions(-) diff --git a/app.py b/app.py index 5739c8b..0384154 100644 --- a/app.py +++ b/app.py @@ -595,7 +595,7 @@ async def hair_grow_b( marked_image_file: Optional[UploadFile] = File(default=None, description="划线图片文件(JPG/PNG,≤ 1 MB)"), marked_image_url: Optional[str] = Form(default=None, description="划线图片 URL"), marked_image_base64: Optional[str] = Form(default=None, description="划线图片 base64"), - use_mask: bool = Form(default=True, description="是否启用自动检测遮罩(测试对比用)。false 时跳过检测、直接送划线图(空遮罩)"), + use_mask: bool = Form(default=True, description="是否画发际线(测试对比用)。false 时跳过划线检测、直接送划线图"), ): # 划线图三选一取图(只需这一张) marked_raw, e = await resolve_image_bytes(marked_image_file, marked_image_url, marked_image_base64) diff --git a/docs/接口文档.md b/docs/接口文档.md index 7769375..a0ebae7 100644 --- a/docs/接口文档.md +++ b/docs/接口文档.md @@ -244,7 +244,7 @@ | 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | marked_image_* | file / string | 是 | 已用马克笔标注发际线的图片,三选一 | -| use_mask | bool | 否 | 是否启用自动检测遮罩,默认 `true`。`false` 时跳过划线检测、直接送划线图(空遮罩),模型仅凭手绘黑线生发,供测试对比 | +| use_mask | bool | 否 | 是否画发际线,默认 `true`。`false` 时跳过划线检测、直接送划线图,模型仅凭手绘黑线生发,供测试对比 | ### 输出(data) diff --git a/static/test_interface2.html b/static/test_interface2.html index c5b8c32..5c5134d 100644 --- a/static/test_interface2.html +++ b/static/test_interface2.html @@ -73,6 +73,13 @@ +
+ + +
@@ -118,6 +125,7 @@ async function submitTest() { setStatus('⏳ 请求中(生发图生成较慢,请耐心)...', 'info'); $('resultsArea').classList.add('hidden'); const fd = new FormData(); fd.append('image_file', f); fd.append('gender', $('gender').value); + fd.append('use_mask', $('useMask').value); try { const r = await fetch(API_BASE + '/api/v1/hair/grow', { method:'POST', body:fd }); const json = await r.json(); diff --git a/static/test_interface3.html b/static/test_interface3.html index 0488721..443c124 100644 --- a/static/test_interface3.html +++ b/static/test_interface3.html @@ -52,6 +52,17 @@ .result-field .name { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; } .badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #dbeafe; color: #1e40af; } + /* blend */ + .blend-container { position: relative; width: 100%; background: #222; border-radius: 8px; overflow: hidden; line-height: 0; } + .blend-container img { display: block; width: 100%; max-height: 500px; object-fit: contain; } + .blend-bottom { position: relative; z-index: 1; } + .blend-top { position: absolute; top: 0; left: 0; z-index: 2; transition: opacity 0.06s; } + .blend-placeholder { color: #9ca3af; font-size: 12px; padding: 80px 20px; background: #f9fafb; line-height: 1.5; } + .blend-controls { display: flex; align-items: center; gap: 10px; margin-top: 14px; justify-content: center; } + .blend-controls input[type=range] { width: 220px; accent-color: #2563eb; } + .blend-label { font-size: 12px; color: #6b7280; font-weight: 600; } + .blend-value { font-size: 13px; font-weight: 600; color: #374151; min-width: 42px; text-align: center; background: #f3f4f6; border-radius: 6px; padding: 2px 8px; } + .json-panel { max-height: 550px; overflow: auto; } .json-content { padding: 14px 16px; font-family: "SF Mono", "Fira Code", monospace; font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; } @@ -72,6 +83,14 @@
✏️ 划线图(marked_image)必填
+
+
🪄 画发际线(use_mask)NEW
+ +
false 时跳过划线检测、直接送划线图,用于对比测试
+
@@ -83,24 +102,19 @@