Datasets:
Download viewer.html from yuanze1024/ShaderAgent-MatScorer-Data: direct link, hf CLI and curl.
- Browser
- Download file 7.63 kB
-
https://huggingface.co/datasets/yuanze1024/ShaderAgent-MatScorer-Data/resolve/main/viewer.html
- Command line
-
hf download hf://datasets/yuanze1024/ShaderAgent-MatScorer-Data/viewer.html
-
curl -L -o viewer.html https://huggingface.co/datasets/yuanze1024/ShaderAgent-MatScorer-Data/resolve/main/viewer.html
7.63 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>ShaderAgent MatScorer Data — viewer</title> | |
| <style> | |
| :root{ | |
| --bg:#0f1113;--panel:#1a1d20;--panel2:#22262a;--ink:#e8e9ea;--muted:#9aa0a6; | |
| --acc:#6bb5ff;--pos:#57c26b;--neg:#f0883e;--line:#2c3136; | |
| } | |
| *{box-sizing:border-box} | |
| html,body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif} | |
| a{color:var(--acc)} | |
| header{position:sticky;top:0;z-index:10;background:#14171a;border-bottom:1px solid var(--line);padding:10px 16px} | |
| header .top{display:flex;gap:14px;align-items:baseline;flex-wrap:wrap} | |
| header b{font-size:15px} | |
| header .sub{color:var(--muted);font-size:12px} | |
| .controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:8px} | |
| button,input[type=search]{background:var(--panel2);color:var(--ink);border:1px solid #3a4046;padding:5px 10px;border-radius:5px;font-size:13px} | |
| button{cursor:pointer} | |
| button.on{background:var(--acc);color:#0f1113;border-color:var(--acc);font-weight:600} | |
| button[data-kind].on{outline:2px solid #fff3} | |
| input[type=search]{min-width:180px} | |
| main{padding:16px;max-width:1200px;margin:0 auto} | |
| .stats{color:var(--muted);font-size:12px;margin:4px 0 14px} | |
| .card{background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:12px 14px;margin-bottom:16px} | |
| .card h3{margin:0 0 4px;font-size:13px;color:var(--acc);font-weight:600;word-break:break-all} | |
| .card .meta{color:var(--muted);font-size:11px;margin-bottom:10px;word-break:break-all} | |
| .row{display:flex;gap:14px;align-items:flex-start;flex-wrap:wrap} | |
| .qcol{flex:0 0 320px;max-width:100%} | |
| .qwrap{position:relative;display:inline-block;max-width:100%} | |
| .qwrap img{width:320px;max-width:100%;display:block;border-radius:4px;background:#000} | |
| .bbox{position:absolute;border:2px solid #ff5252;box-shadow:0 0 0 1px rgba(255,82,82,.35);border-radius:2px;pointer-events:none} | |
| .cap{font-size:11px;color:var(--muted);margin-top:5px;word-break:break-all} | |
| .ccol{flex:1;min-width:300px;display:flex;flex-direction:column;gap:10px} | |
| .cand{border:1px solid var(--line);border-radius:6px;padding:8px;background:var(--panel2)} | |
| .cand img{width:100%;display:block;border-radius:3px;background:#222} | |
| .cand .tag{font-size:10px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;margin-right:6px} | |
| .cand.pos{border-color:#2f5b33}.cand.pos .tag{color:var(--pos)} | |
| .cand.neg{border-color:#6b4226}.cand.neg .tag{color:var(--neg)} | |
| .moreneg{color:var(--muted);font-size:11px} | |
| footer{color:var(--muted);font-size:11px;text-align:center;padding:24px} | |
| .skeleton{color:var(--muted);padding:40px;text-align:center} | |
| @media (max-width:720px){.qcol{flex:1 1 100%}.qwrap img{width:100%}} | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <div class="top"> | |
| <b>ShaderAgent MatScorer Data</b> | |
| <span class="sub">each card = one listwise group · red box = query region · green = chosen positive · orange = rejected negatives</span> | |
| </div> | |
| <div class="controls" id="controls"> | |
| <span class="sub">config</span> | |
| <button data-kind="cfg" data-v="all" class="on">all</button> | |
| <span class="sub" id="lab-label" style="margin-left:10px">label</span> | |
| <button data-kind="lab" data-v="all" class="on">all</button> | |
| <input id="q" type="search" placeholder="filter by id / scene / material / group…"> | |
| </div> | |
| </header> | |
| <main> | |
| <div class="stats" id="stats">loading…</div> | |
| <div id="cards"><div class="skeleton">loading viewer_assets/cards.js …</div></div> | |
| </main> | |
| <footer> | |
| images shown are lossy WebP thumbnails · full-resolution PNGs are the | |
| <code>images/…</code> paths referenced by the annotations · | |
| <a href="https://huggingface.co/datasets/yuanze1024/ShaderAgent-MatScorer-Data">dataset card</a> · <a href="https://github.com/VAST-AI-Research/ShaderAgent">ShaderAgent code</a> | |
| </footer> | |
| <script src="viewer_assets/cards.js"></script> | |
| <script> | |
| const $ = (s, r=document) => r.querySelector(s); | |
| const $$ = (s, r=document) => [...r.querySelectorAll(s)]; | |
| const esc = s => String(s).replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); | |
| const CFG_OF_SPLIT = s => s.split('/')[0]; | |
| let CARDS = [], CFILTER = 'all', LFILTER = 'all', TEXT = ''; | |
| function candHtml(c, label){ | |
| return `<div class="cand ${label}"> | |
| <img loading="lazy" src="${esc(c.thumb)}" alt="${label}"> | |
| <div class="cap"><span class="tag">${label}</span>${esc(c.cap)}</div> | |
| </div>`; | |
| } | |
| function render(){ | |
| const host = $('#cards'); | |
| const frag = document.createDocumentFragment(); | |
| let shown = 0; | |
| for (const c of CARDS){ | |
| if (CFILTER !== 'all' && CFG_OF_SPLIT(c.split) !== CFILTER) continue; | |
| if (LFILTER !== 'all' && c.label_source !== LFILTER) continue; | |
| if (TEXT){ | |
| const hay = (c.id + ' ' + c.meta + ' ' + c.split + ' ' + c.pos.cap + ' ' + c.negs.map(n=>n.cap).join(' ')).toLowerCase(); | |
| if (!hay.includes(TEXT)) continue; | |
| } | |
| shown++; | |
| const q = c.query, [x1,y1,x2,y2] = q.bbox, [w,h] = q.size; | |
| const L = x1/w*100, T = y1/h*100, W = (x2-x1)/w*100, H = (y2-y1)/h*100; | |
| const sec = document.createElement('section'); | |
| sec.className = 'card'; | |
| sec.innerHTML = ` | |
| <h3>${esc(c.split)} · ${esc(c.id)}</h3> | |
| <div class="meta">${esc(c.meta)} · label_source=${esc(c.label_source)}</div> | |
| <div class="row"> | |
| <div class="qcol"> | |
| <div class="qwrap"><img loading="lazy" src="${esc(q.thumb)}" alt="query"> | |
| <div class="bbox" style="left:${L.toFixed(2)}%;top:${T.toFixed(2)}%;width:${W.toFixed(2)}%;height:${H.toFixed(2)}%"></div> | |
| </div> | |
| <div class="cap">query ${w}×${h} · bbox=[${x1},${y1},${x2},${y2}] px</div> | |
| </div> | |
| <div class="ccol"> | |
| ${candHtml(c.pos, 'pos')} | |
| ${c.negs.map((n,i)=>candHtml(n,'neg')).join('')} | |
| ${c.n_neg_total > c.negs.length ? `<div class="moreneg">+ ${c.n_neg_total - c.negs.length} more negatives in the record</div>` : ''} | |
| </div> | |
| </div>`; | |
| frag.appendChild(sec); | |
| } | |
| host.innerHTML = ''; | |
| host.appendChild(frag); | |
| $('#stats').textContent = `${shown} of ${CARDS.length} sampled groups`; | |
| } | |
| function buildFilters(){ | |
| const cfg = [...new Set(CARDS.map(c => CFG_OF_SPLIT(c.split)))].sort(); | |
| const lab = [...new Set(CARDS.map(c => c.label_source))].sort(); | |
| const host = $('#controls'); | |
| const anchor = $('#lab-label'); | |
| cfg.forEach(v => host.insertBefore(mkBtn('cfg', v), anchor)); | |
| lab.forEach(v => host.appendChild(mkBtn('lab', v))); | |
| $$('button').forEach(b => b.onclick = () => { | |
| $$(`button[data-kind=${b.dataset.kind}]`).forEach(x => x.classList.toggle('on', x === b)); | |
| if (b.dataset.kind === 'cfg') CFILTER = b.dataset.v; else LFILTER = b.dataset.v; | |
| render(); | |
| }); | |
| } | |
| function mkBtn(kind, v){ | |
| const b = document.createElement('button'); | |
| b.dataset.kind = kind; b.dataset.v = v; b.textContent = v; | |
| return b; | |
| } | |
| // cards.js assigns this global. A <script src> works from file://, which is how | |
| // the dataset card tells people to open this page; fetch() would be blocked. | |
| try { | |
| const d = window.__MATSCORER_CARDS__; | |
| if (!d || !Array.isArray(d.cards)) { | |
| throw new Error('viewer_assets/cards.js did not load — keep it next to this file'); | |
| } | |
| CARDS = d.cards; | |
| buildFilters(); | |
| render(); | |
| } catch (e) { | |
| $('#cards').innerHTML = `<div class="skeleton">could not load the card data: ${esc(e.message)}</div>`; | |
| $('#stats').textContent = ''; | |
| } | |
| $('#q').addEventListener('input', ev => { TEXT = ev.target.value.trim().toLowerCase(); render(); }); | |
| </script> | |
| </body> | |
| </html> | |