feat: 新增52号发际线接口并限制GPU worker来源IP

保留5号历史三档实现,新增中下庭高度定位、扶正裁切、矩形叠加与30案例对比页。

worker仅允许本机和配置白名单访问;网关不增加IP限制。空图片URL字段改写限定为52号,保持旧接口兼容。同步接口、裁切与部署文档。

验证:113项测试通过;1项历史数值基线失败,在未修改的a3fddbb版本复现。浏览器验证5/52及30案例对比页通过。
This commit is contained in:
xsl
2026-11-04 10:20:29 +08:00
parent a3fddbbc34
commit 5b2b73f5d5
35 changed files with 2826 additions and 26 deletions
+52
View File
@@ -0,0 +1,52 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>接口 52 · 发际线高度规则对比</title>
<link rel="stylesheet" href="/static/hairline_height_compare.css">
<script src="/static/img_downscale.js?v=2" defer></script>
<script src="/static/hairline_reference_box.js" defer></script>
<script src="/static/hairline_height_compare.js" defer></script>
</head>
<body>
<main>
<header class="page-header">
<div><div class="eyebrow">接口 52 / 规则验证</div><h1>发际线高度规则对比</h1><p>用同一张照片、同一个形状,查看旧规则与中下庭均值规则的位置差异。</p></div>
<a class="button secondary" href="/static/test_interface52.html">打开规则测试页 ↗</a>
</header>
<section class="rule-card" aria-label="规则说明">
<div><span class="pill">新规则</span><h2>目标上庭 =(中庭 + 下庭)÷ 2</h2><p>从眉心向上定位,所有形状的中点对齐同一高度。各发型保留自身轮廓,叠加在扶正后的底图上。</p></div>
<div class="rule-note"><span class="dot old"></span>旧规则:根据头发边界和模板定位<br><span class="dot new"></span>新规则:根据中庭、下庭定位<br><span class="dash"></span>虚线:新规则的目标高度</div>
</section>
<details class="framing-standard"><summary>查看已扶正的标准图与裁切参数</summary><div id="framingStandard">正在加载标准图参数…</div></details>
<section class="stats" aria-label="验证概况">
<div><span>已验证图片</span><strong id="statCases">—</strong><small>独立测试图片</small></div>
<div><span>发际线对比</span><strong id="statComparisons">—</strong><small>男性 / 女性各 7 型</small></div>
<div><span>最大中心误差</span><strong id="statError">—</strong><small>新中心与目标的像素差</small></div>
<div><span>验证状态</span><strong id="statStatus">加载中</strong><small id="runTime">正在读取已保存结果</small></div>
</section>
<section class="toolbar" aria-label="显示设置">
<label>发型集合<select id="genderFilter"><option value="all" selected>全部集合(男女各 7 型)</option><option value="female">女性发际线</option><option value="male">男性发际线</option></select></label>
<label>形状<select id="styleFilter"></select></label>
<label>图片<select id="caseFilter"><option value="all">全部 30 个案例</option></select></label>
<div class="segmented" aria-label="对比方式"><button id="sideMode" class="active" type="button">左右对比</button><button id="overlayMode" type="button">同图叠线</button></div>
<label class="check"><input type="checkbox" id="zoomFace">额头特写</label>
<label class="check"><input type="checkbox" id="showTarget" checked>目标参考线</label>
<label class="check"><input type="checkbox" id="showBox" checked>新图参考框</label>
</section>
<p id="status" class="status" role="status" aria-live="polite">正在加载30个案例的对比结果…</p>
<section id="results" class="results" aria-label="案例对比"></section>
<section class="tools-card">
<div class="tools-heading"><div><h2>继续验证</h2><p>上传新图片,或重新运行清单全部30张。每人先显示未裁切原图,再显示旧、新规则;对比只生成定位曲线,无需等待生发。</p></div><button id="rerunBatch" class="button secondary" type="button">重跑全部30个案例</button></div>
<form id="customForm" class="custom-form">
<label>选择图片<input id="customFile" type="file" accept="image/png,image/jpeg" required></label>
<label>发型集合<select id="customGender"><option value="female">女性 · 7 型</option><option value="male">男性 · 7 型</option></select></label>
<button class="button primary" id="customRun" type="submit">运行自定义对比</button>
</form>
<p class="footnote">high、low 已停用;接口旧字段保留为 null。当前页的“旧规则”是本次高度修改前的定位逻辑。旧、新规则使用同一张处理后底图。</p>
</section>
<footer>旧线 <span class="dot old"></span> 橙色 · 新线 <span class="dot new"></span> 青色 · 粉色参考框:两侧均平行 9→152,左边经过 162、右边经过 389、底边经过 9;高度为 9→152 距离的 70%<br>向上移动为负,向下移动为正 · 所有距离基于接口实际输入图片</footer>
</main>
</body>
</html>