diff --git a/gateway/app.py b/gateway/app.py index 9ddd648..446f78c 100644 --- a/gateway/app.py +++ b/gateway/app.py @@ -196,6 +196,7 @@ async def index(): "if3_hair_grow_b": "/static/test_interface3.html", "if4_features": "/static/test_interface4.html", "if5_hairline": "/static/test_interface5.html", + "if7_hair_grow_v2": "/static/test_interface7.html", }, } @@ -320,3 +321,9 @@ async def face_features( async def hairline_generate(request: Request): """接口5:发际线PNG生成""" return await _proxy(request, "/api/v1/hairline/generate") + + +@app.post("/api/v1/hair/grow-v2", tags=["生发"]) +async def hair_grow_v2(request: Request): + """接口7:C端生发 v2(add_hair2 工作流)""" + return await _proxy(request, "/api/v1/hair/grow-v2") diff --git a/static/integration.html b/static/integration.html index 3e7e9c4..9048afb 100644 --- a/static/integration.html +++ b/static/integration.html @@ -56,6 +56,7 @@ 接口3 接口4 接口5 + 接口7 错误码 在线测试 @@ -129,13 +130,14 @@ const { code, data } = await res.json();
/api/v1/hair/grow上传正面照 + 性别 → 多组发际线方案。每组含发际线叠加预览图 + ComfyUI 生发效果图。
+上传正面照 + 性别 + 发型序号 → 返回指定发际线类型的预览图与生发图。
入参
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image_file / image_url / image_base64 | — | 三选一 | 用户正面照 |
| gender | string | ✅ 必填 | "male" / "female" |
| hair_style | int | ✅ 必填 | 发型序号。female: 1~5,male: 1~4(见下方映射) |
data.results[] 元素
@@ -233,6 +235,37 @@ console.log(features['四季色彩季型']); // "冷夏型"(中文字段也保/api/v1/hair/grow-v2 v2功能与接口2完全一致,仅 ComfyUI 工作流不同——使用 add_hair2.json 替代 add_hair.json(Flux-2 Klein 9b)。
入参
+| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image_file / image_url / image_base64 | — | 三选一 | 用户正面照 |
| gender | string | ✅ 必填 | "male" / "female" |
| hair_style | int | ✅ 必填 | 发型序号。female: 1~5,male: 1~4 |
data.results[] 元素(同接口2)
+| 字段 | 类型 | 说明 |
|---|---|---|
image_url | string | 发际线叠加预览图 |
grown_image_url | string | 生发后效果图 ⚠ 可空 |
hairline_type | string | 发际线类型 key |
order | int | 排序 |
+ Female 5 种:ellipse/flower/heart/straight/wave |
+ Male 4 种:ellipse/m/straight/inverse_arc
+ ⚠ 工作流: add_hair2.json(Flux-2 Klein 9b),输入节点 26,输出节点 75。
+
完整 API 文档:/docs(Swagger UI) diff --git a/static/test_interface2.html b/static/test_interface2.html index 814baad..0d0938d 100644 --- a/static/test_interface2.html +++ b/static/test_interface2.html @@ -21,6 +21,12 @@ .form-group { display: flex; align-items: center; gap: 6px; white-space: nowrap; } .form-group label { font-size: 13px; font-weight: 600; color: #374151; } .form-group select { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; } + .hair-checkboxes { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; } + .hair-checkboxes label { font-size: 13px; font-weight: 500; color: #374151; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; } + .hair-checkboxes label input[type=checkbox] { cursor: pointer; } + .checkbox-actions { display: flex; gap: 6px; margin-left: 4px; } + .checkbox-actions button { font-size: 11px; padding: 2px 8px; border-radius: 4px; border: 1px solid #d1d5db; background: #f9fafb; cursor: pointer; } + .checkbox-actions button:hover { background: #e5e7eb; } .btn { padding: 10px 28px; border: none; border-radius: 8px; font-size: 15px; cursor: pointer; font-weight: 600; transition: .2s; } .btn-primary { background: #2563eb; color: #fff; } .btn-primary:hover { background: #1d4ed8; } @@ -63,7 +69,7 @@
POST /api/v1/hair/grow | 正面照 + 性别 → 每个方案展示:原图 / 发际线叠加 / 生发效果
+POST /api/v1/hair/grow | 正面照 + 性别 + 发型多选 → 所选发型的预览图与生发图