Download view_template.html from waveshaker/comfyui-lora-bench: direct link, hf CLI and curl.
- Browser
- Download file 9.1 kB
-
https://huggingface.co/waveshaker/comfyui-lora-bench/resolve/main/view_template.html
- Command line
-
hf download hf://waveshaker/comfyui-lora-bench/view_template.html
-
curl -L -o view_template.html https://huggingface.co/waveshaker/comfyui-lora-bench/resolve/main/view_template.html
9.1 kB
| <html lang="zh"><head><meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <title>LoRA Bench</title> | |
| <style> | |
| *{box-sizing:border-box} | |
| html,body{height:100%;margin:0} | |
| body{background:#fff;display:flex;align-items:center;justify-content:center;padding:18px; | |
| font:12.5px/1.5 -apple-system,"Segoe UI","Microsoft YaHei",sans-serif;overflow:hidden} | |
| #app{width:100%;max-width:1520px;height:100%;background:#101011;color:#e6e6e6; | |
| border-radius:14px;overflow:hidden;display:flex;flex-direction:column; | |
| box-shadow:0 20px 60px rgba(0,0,0,.30),0 0 0 1px rgba(0,0,0,.08)} | |
| header{flex:0 0 44px;display:flex;align-items:center;gap:10px;padding:0 16px; | |
| background:#171719;border-bottom:1px solid #2a2a2e} | |
| header .t{font-size:13.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} | |
| header .b{color:#7cc4ff;font-weight:600} | |
| header .tag{color:#6e6e78;font-weight:400;font-size:11.5px; | |
| font-family:ui-monospace,Consolas,"Courier New",monospace} | |
| .sp{flex:1} | |
| button{background:#232327;color:#dcdce0;border:1px solid #34343a;border-radius:6px; | |
| padding:4px 11px;font:inherit;cursor:pointer} | |
| button:hover{border-color:#5a5a64;color:#fff} | |
| #main{flex:1;display:grid;grid-template-columns:170px minmax(0,1fr) 400px;min-height:0} | |
| #cases{overflow-y:auto;border-right:1px solid #2a2a2e;padding:6px} | |
| .c{display:block;width:100%;text-align:left;background:none;border:1px solid transparent; | |
| border-radius:6px;padding:5px 8px;margin-bottom:1px;color:#cfcfd4;cursor:pointer;font:inherit} | |
| .c:hover{background:#1d1d21} | |
| .c.on{background:#1f2b3a;border-color:#2f5a86;color:#fff} | |
| .c b{display:block;font-size:12px} | |
| .c i{display:block;font-size:11px;color:#86868e;font-style:normal} | |
| #center{display:flex;flex-direction:column;min-height:0;padding:8px;gap:6px} | |
| .stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center; | |
| background:#08080a;border:1px solid #2a2a2e;border-radius:8px;overflow:hidden} | |
| .stage img{max-width:100%;max-height:100%;width:auto;height:auto;display:block} | |
| .ticks{flex:0 0 auto;display:flex;gap:4px;overflow-x:auto} | |
| .ticks img{height:54px;border-radius:4px;border:2px solid transparent;opacity:.5;cursor:pointer;flex:0 0 auto} | |
| .ticks img.on{border-color:#4a9eff;opacity:1} | |
| .sliderow{flex:0 0 auto;display:flex;align-items:center;gap:10px} | |
| .sliderow input{flex:1;accent-color:#4a9eff} | |
| .sv{font-variant-numeric:tabular-nums;font-weight:700;color:#7cc4ff;min-width:42px;text-align:right} | |
| #side{overflow-y:auto;border-left:1px solid #2a2a2e;padding:10px 12px 16px} | |
| .lab{font-size:10.5px;color:#7a7a82;text-transform:uppercase;letter-spacing:.08em;margin:10px 0 3px} | |
| .lab:first-child{margin-top:0} | |
| code{display:block;background:#17171a;border:1px solid #2a2a2e;border-radius:6px; | |
| padding:7px 9px;color:#9ad0a0;white-space:pre-wrap;word-break:break-word;font-size:11.5px} | |
| pre{margin:0;background:#141416;border:1px solid #2a2a2e;border-radius:6px;padding:9px 10px; | |
| color:#c8c8ce;font:11px/1.6 ui-monospace,Consolas,"Courier New",monospace; | |
| white-space:pre-wrap;word-break:break-word} | |
| details{margin-top:12px} | |
| details summary{cursor:pointer;color:#7a7a82;font-size:10.5px; | |
| text-transform:uppercase;letter-spacing:.08em;outline:none} | |
| details .r{margin-top:5px;color:#9a9aa2;font-size:11.5px} | |
| details .r b{color:#cfcfd4} | |
| </style></head><body> | |
| <div id="app"> | |
| <header> | |
| <div class="t">LoRA Bench <span class="b" id="bn"></span> <span class="tag" id="btag"></span></div> | |
| <div class="sp"></div> | |
| <button id="langBtn">EN</button> | |
| </header> | |
| <div id="main"> | |
| <aside id="cases"></aside> | |
| <div id="center"> | |
| <div class="stage"><img id="big" alt=""></div> | |
| <div class="ticks" id="ticks"></div> | |
| <div class="sliderow"><input type="range" id="slider" min="0" max="0" step="1"><div class="sv" id="sVal"></div></div> | |
| </div> | |
| <aside id="side"> | |
| <div class="lab" id="labP"></div> | |
| <code id="prompt"></code> | |
| <div class="lab" id="labR"></div> | |
| <pre id="rep"></pre> | |
| <details id="termsBox"><summary id="labT"></summary><div id="terms"></div></details> | |
| </aside> | |
| </div> | |
| </div> | |
| <script src="./mock_data/data.js"></script> | |
| <script> | |
| (function () { | |
| const D = window.BENCH_DATA || null; | |
| if (!D) { | |
| document.body.innerHTML = | |
| '<div style="position:fixed;inset:0;display:flex;align-items:center;justify-content:center;' | |
| + 'font:14px/1.9 -apple-system,\'Microsoft YaHei\',sans-serif;color:#222;background:#fff;padding:40px">' | |
| + '<div style="max-width:600px">' | |
| + '<h2 style="margin:0 0 14px;font-size:18px">还没有数据 / No data yet</h2>' | |
| + '<p>模板会读取 <code style="background:#f2f2f2;padding:2px 5px;border-radius:3px">./mock_data/data.js</code>。' | |
| + '先跑一次导出:</p>' | |
| + '<pre style="background:#f5f5f5;padding:12px 14px;border-radius:6px;font-size:12.5px">' | |
| + 'python bench.py --object --mock</pre>' | |
| + '<p>然后刷新本页即可看到真实数据;之后改 <code style="background:#f2f2f2;padding:2px 5px;border-radius:3px">view_template.html</code> ' | |
| + '的样式,按 F5 就生效,不用重跑管线。</p>' | |
| + '<hr style="border:none;border-top:1px solid #eee;margin:18px 0">' | |
| + '<p style="color:#666;font-size:12.5px">Loads <code>./mock_data/data.js</code>. Run ' | |
| + '<code>bench.py --object --mock</code> to export it, then reload. Editing the template no longer needs a rerun.</p>' | |
| + '</div></div>'; | |
| return; | |
| } | |
| const R = D.runs[0]; | |
| let L = "cn", sel = null, si = 0, ss = []; | |
| const TX = { | |
| cn:{prompt:"提示词 Prompt", report:"报告 Report", terms:"术语说明 Glossary"}, | |
| en:{prompt:"Prompt", report:"Report", terms:"Glossary"} | |
| }; | |
| const T = () => TX[L]; | |
| const esc = s => String(s==null?"":s).replace(/[&<>]/g,c=>({"&":"&","<":"<",">":">"}[c])); | |
| const caseIds = () => D.cases.filter(c => R.cells[c.id]).map(c => c.id); | |
| const ssOf = id => Object.keys(R.cells[id]||{}).sort((a,b)=>parseFloat(a)-parseFloat(b)); | |
| function draw(){ | |
| const ids = caseIds(); | |
| if (!ids.length){ document.body.innerHTML = "<p style='padding:20px'>no images</p>"; return; } | |
| if (!sel || ids.indexOf(sel) < 0) sel = ids[0]; | |
| document.getElementById("bn").textContent = | |
| "[" + D.bench + "] " + (L === "cn" ? D.bench_cn : D.bench_en); | |
| document.getElementById("btag").textContent = R.tag || ""; | |
| const al = document.getElementById("cases"); | |
| al.innerHTML = ""; | |
| D.cases.forEach(c => { | |
| if (!R.cells[c.id]) return; | |
| const b = document.createElement("button"); | |
| b.className = "c" + (c.id === sel ? " on" : ""); | |
| b.innerHTML = "<b>" + esc(c.id) + "</b><i>" + esc(L==="cn"?c.cn:c.en) + "</i>"; | |
| b.onclick = () => { sel = c.id; si = 0; draw(); }; | |
| al.appendChild(b); | |
| }); | |
| ss = ssOf(sel); | |
| if (si >= ss.length) si = ss.length - 1; | |
| const s = ss[si]; | |
| document.getElementById("big").src = R.cells[sel][s]; | |
| const sl = document.getElementById("slider"); | |
| sl.min = 0; sl.max = Math.max(0, ss.length-1); sl.value = si; | |
| sl.oninput = () => { si = +sl.value; draw(); }; | |
| document.getElementById("sVal").textContent = s; | |
| const tk = document.getElementById("ticks"); | |
| tk.innerHTML = ""; | |
| ss.forEach((k,i) => { | |
| const im = document.createElement("img"); | |
| im.src = R.cells[sel][k]; im.title = k; | |
| im.className = i === si ? "on" : ""; | |
| im.onclick = () => { si = i; draw(); }; | |
| tk.appendChild(im); | |
| }); | |
| const c = D.cases.find(x => x.id === sel); | |
| document.getElementById("labP").textContent = T().prompt; | |
| document.getElementById("prompt").textContent = c.prompt.replace("{t}", R.trigger || ""); | |
| document.getElementById("labR").textContent = T().report; | |
| const pre = document.getElementById("rep"); | |
| const repTxt = (D.report[L] || "").trim(); | |
| pre.textContent = repTxt || (L === "cn" | |
| ? "(还没有报告)\n先跑一次完整运行,或对已有目录执行:\npython bench.py --report-only NNNNN" | |
| : "(no report yet)\nRun a full pass first, or rebuild from an existing run:\npython bench.py --report-only NNNNN"); | |
| pre.style.color = repTxt ? "" : "#5a5a62"; | |
| document.getElementById("labT").textContent = T().terms; | |
| document.getElementById("terms").innerHTML = | |
| D.terms.map(t => "<div class='r'><b>"+esc(t.k)+"</b> — "+esc(L==="cn"?t.cn:t.en)+"</div>").join(""); | |
| document.getElementById("langBtn").textContent = L === "cn" ? "EN" : "中文"; | |
| } | |
| document.getElementById("langBtn").onclick = () => { L = L==="cn"?"en":"cn"; draw(); }; | |
| document.addEventListener("keydown", e => { | |
| if (e.key === "ArrowLeft" || e.key === "ArrowRight") { | |
| si = Math.max(0, Math.min(ss.length-1, si + (e.key==="ArrowRight"?1:-1))); | |
| draw(); e.preventDefault(); | |
| } else if (e.key === "ArrowUp" || e.key === "ArrowDown") { | |
| const ids = caseIds(), i = ids.indexOf(sel); | |
| sel = ids[Math.max(0, Math.min(ids.length-1, i + (e.key==="ArrowDown"?1:-1)))]; | |
| si = 0; draw(); e.preventDefault(); | |
| } | |
| }); | |
| draw();})(); | |
| </script></body></html> |