From e58ece0ada6ef1e1f2e43111b79820b94b10227b Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 23 Jun 2026 23:30:24 +0800 Subject: [PATCH] save code --- face_features.py | 10 ++ gateway/app.py | 1 + static/integration.html | 31 ++++ static/test_interface6.html | 274 ++++++++++++++++++++++++++++++++++++ 4 files changed, 316 insertions(+) create mode 100644 static/test_interface6.html diff --git a/face_features.py b/face_features.py index d8fc797..eda031b 100644 --- a/face_features.py +++ b/face_features.py @@ -103,6 +103,16 @@ def analyze_features(image_bytes: bytes = None, image_url: str = None): {"type": "image_url", "image_url": {"url": url}}, {"type": "text", "text": _PROMPT}, ], + # 【SDK原生支持的标准参数,绝对不报错】 + max_tokens=1024, # 限制输出长度,模型秒回 + temperature=0, # 固定输出,无随机采样,提速+结果稳定 + stream=False, # 关闭流式,单次返回结果更快 + # 【官方正确写法】扩展参数必须放在extra_body中传递 + extra_body={ + "thinking": { + "type": "disabled" # 【核心提速】彻底关闭深度思考模式,提速50%+,官方标准格式{insert\_element\_1\_} + } + } }], ) text = resp.choices[0].message.content diff --git a/gateway/app.py b/gateway/app.py index 9d95d09..b58a24d 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", + "if6_measure_v2": "/static/test_interface6.html", "if7_hair_grow_v2": "/static/test_interface7.html", }, } diff --git a/static/integration.html b/static/integration.html index 9048afb..f5a7367 100644 --- a/static/integration.html +++ b/static/integration.html @@ -56,6 +56,7 @@ 接口3 接口4 接口5 + 接口6 接口7 错误码 在线测试 @@ -235,6 +236,35 @@ console.log(features['四季色彩季型']); // "冷夏型"(中文字段也保 + +
+

6. 四庭七眼测量 v2  POST  /api/v1/face/measure-v2  v2

+
+

基于接口1的变体。上传正面照 → 返回标注 PNG + 三庭七眼数据。与接口1 的差异:

+
    +
  • 去顶庭:不画头顶横线、不返回顶庭数据,face_total_height_cm = 上+中+下庭
  • +
  • 竖线范围:发际线→下巴尖(接口1 为头顶→下巴尖)
  • +
  • 无头部端线:仅七眼 6 点 5 段标尺(接口1 为 8 点 7 段)
  • +
+ +

入参

+ + + +
参数类型必填说明
image_file / image_url / image_base64三选一用户正面照
+ +

data 字段

+ + + + + + + +
字段类型说明
annotated_image_urlstring标注 PNG URL(仅标注图层,透明底)
face_total_height_cmnumber面部总高度(cm)= 三庭之和
four_courtsobject三庭:upper/middle/lower,各含 _cm 和 ratios(无 top_court
seven_eyesobject七眼:eye_width/face_width/inter_eye_distance
landmarksobject4 个关键点:hairline/brow_center/nose_bottom/chin_tip(无 hair_top
+
+
+

7. C端生发 v2  POST  /api/v1/hair/grow-v2  v2

@@ -295,6 +325,7 @@ console.log(features['四季色彩季型']); // "冷夏型"(中文字段也保 3. B端生发/static/test_interface3.html划线图上传 → 生发效果图 4. 用户特征/static/test_interface4.html上传照片 → 42项面部特征表格 + 原始JSON 5. 发际线PNG/static/test_interface5.html上传+性别 → 发际线方案+中心点坐标 + 6. 四庭七眼 v2/static/test_interface6.html同接口1,去顶庭 · 竖线发际线→下巴 · 无头部端线 7. C端生发 v2/static/test_interface7.html同接口2,使用 add_hair2.json 工作流(Flux-2 Klein 9b)

diff --git a/static/test_interface6.html b/static/test_interface6.html new file mode 100644 index 0000000..ff81b1a --- /dev/null +++ b/static/test_interface6.html @@ -0,0 +1,274 @@ + + + + + +接口6 — 四庭七眼测量 v2 测试页 + + + +

+

📐 四庭七眼测量 v2 — 接口测试 v2

+

POST /api/v1/face/measure-v2  |  去顶庭 · 竖线发际线→下巴 · 无头部端线

+
    +
  • 去顶庭:不画头顶横线,不返回顶庭数据;face_total_height_cm = 上+中+下庭
  • +
  • 竖线范围:发际线→下巴尖(接口1 为头顶→下巴尖)
  • +
  • 不画头部端线:仅七眼 6 点 5 段标尺(接口1 为 8 点 7 段)
  • +
+ + +
+
+
+ +
+ + +
+
+ 支持 JPG / PNG 正面照  |  单文件 ≤ 1 MB  |  也可拖拽图片到文件选择框 +
+ +
+ + + + + + +
+ + + +