CarterBenjamin commited on
Commit
a555898
·
verified ·
1 Parent(s): 3c02a08

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +11 -15
index.html CHANGED
@@ -52,15 +52,14 @@
52
 
53
  <label>模型</label>
54
  <select id="model">
55
- <option value="local">本站自带(自训 head/body,12 MB)</option>
56
- <option value="11n">Vombit yolo11n_cs2(需 token)</option>
57
- <option value="11s">Vombit yolo11s_cs2(需 token)</option>
58
  </select>
59
 
60
- <label>HF token(只在用 Vombit 那两个 gated 模型时填)</label>
61
  <input id="token" type="text" placeholder="hf_xxx(只留在你浏览器里)" autocomplete="off" />
62
- <div class="hint">这两个仓库是 gated:页面直接带你的 token 去 huggingface.co 取权重,
63
- 本站不转发、不存储。token 只用于这一次请求。</div>
64
 
65
  <label>置信度阈值 <span id="cfv">0.35</span></label>
66
  <input id="conf" type="range" min="0.05" max="0.9" step="0.05" value="0.35" />
@@ -69,7 +68,7 @@
69
  <input id="iou" type="range" min="0.1" max="0.9" step="0.05" value="0.45" />
70
 
71
  <div class="row">
72
- <button class="primary" id="run" disabled>检测</button>
73
  </div>
74
  <div id="log">等模型就绪…</div>
75
  </section>
@@ -85,11 +84,10 @@
85
 
86
  <script>
87
  const MODELS = {
88
- local: { url: "cs2.onnx", labels: ["head", "body"], size: [320, 320] },
89
- "11n": { url: "https://huggingface.co/Vombit/yolo11n_cs2/resolve/main/yolo11n_cs2.onnx",
90
- labels: ["c", "ch", "t", "th"], size: [640, 640], gated: true },
91
  "11s": { url: "https://huggingface.co/Vombit/yolo11s_cs2/resolve/main/yolo11s_cs2.onnx",
92
  labels: ["c", "ch", "t", "th"], size: [640, 640], gated: true },
 
 
93
  };
94
  const ZH = { head:"头部", body:"身体", c:"CT 身体", ch:"CT 头", t:"T 身体", th:"T 头" };
95
  const COLORS = { head:"#ff5b52", body:"#7fd1ff", c:"#7fd1ff", ch:"#ff5b52", t:"#e8c05a", th:"#ff78dc" };
@@ -202,6 +200,7 @@ async function detect() {
202
  if (!img) return;
203
  const key = $("model").value;
204
  const token = $("token").value.trim();
 
205
  const conf = parseFloat($("conf").value), iouThr = parseFloat($("iou").value);
206
  const t0 = performance.now();
207
  try {
@@ -280,13 +279,10 @@ $("model").addEventListener("change", async () => {
280
 
281
  (async () => {
282
  try {
283
- await getSession("local", "");
284
- $("run").disabled = false;
285
- log("模型就绪。选一张图或点示例。");
286
  await loadImage("examples/sample01.png");
287
- detect();
288
  } catch (e) {
289
- log("初始化失败:" + e.message + "\n(如果是 CDN 被挡,onnnxruntime-web 的 js 加载不出来)");
290
  }
291
  })();
292
  </script>
 
52
 
53
  <label>模型</label>
54
  <select id="model">
55
+ <option value="11s">Vombit yolo11s_cs2(默认,准)</option>
56
+ <option value="11n">Vombit yolo11n_cs2(快)</option>
 
57
  </select>
58
 
59
+ <label>HF token(这两个都是 gated 仓库,必填)</label>
60
  <input id="token" type="text" placeholder="hf_xxx(只留在你浏览器里)" autocomplete="off" />
61
+ <div class="hint">页面带你的 token 直接去 huggingface.co 取权重,本站不转发、不存储、不重新分发。
62
+ 前提:你账号已在这两个仓库页点过 Agree。</div>
63
 
64
  <label>置信度阈值 <span id="cfv">0.35</span></label>
65
  <input id="conf" type="range" min="0.05" max="0.9" step="0.05" value="0.35" />
 
68
  <input id="iou" type="range" min="0.1" max="0.9" step="0.05" value="0.45" />
69
 
70
  <div class="row">
71
+ <button class="primary" id="run">检测</button>
72
  </div>
73
  <div id="log">等模型就绪…</div>
74
  </section>
 
84
 
85
  <script>
86
  const MODELS = {
 
 
 
87
  "11s": { url: "https://huggingface.co/Vombit/yolo11s_cs2/resolve/main/yolo11s_cs2.onnx",
88
  labels: ["c", "ch", "t", "th"], size: [640, 640], gated: true },
89
+ "11n": { url: "https://huggingface.co/Vombit/yolo11n_cs2/resolve/main/yolo11n_cs2.onnx",
90
+ labels: ["c", "ch", "t", "th"], size: [640, 640], gated: true },
91
  };
92
  const ZH = { head:"头部", body:"身体", c:"CT 身体", ch:"CT 头", t:"T 身体", th:"T 头" };
93
  const COLORS = { head:"#ff5b52", body:"#7fd1ff", c:"#7fd1ff", ch:"#ff5b52", t:"#e8c05a", th:"#ff78dc" };
 
200
  if (!img) return;
201
  const key = $("model").value;
202
  const token = $("token").value.trim();
203
+ if (!token) { log("先把 HF token 填进来(这两个模型都是 gated,没有 token 取不到权重)。"); return; }
204
  const conf = parseFloat($("conf").value), iouThr = parseFloat($("iou").value);
205
  const t0 = performance.now();
206
  try {
 
279
 
280
  (async () => {
281
  try {
 
 
 
282
  await loadImage("examples/sample01.png");
283
+ log("示例图已载入。填好 HF token 后点「检测」(权重会在那一步下载,约 36 MB)。");
284
  } catch (e) {
285
+ log("示例图没载入:" + e.message);
286
  }
287
  })();
288
  </script>