PixelWorld-dashboard / image_benchmarks.html
HuggingFriends's picture
Refresh PixelWorld main suite progress
e720145 verified
Raw History Blame Contribute Delete
8.67 kB
<!doctype html>
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>PixelWorld · Image benchmarks</title>
<style>
:root{font-family:Inter,system-ui,-apple-system,sans-serif;color:#202633;background:#f5f6f8}*{box-sizing:border-box}body{margin:0}main{max-width:1280px;margin:auto;padding:32px 24px}a{color:#315cc6;text-decoration:none}a:hover{text-decoration:underline}h1{font-size:32px;margin:20px 0 10px}h2{margin:0;font-size:24px}.muted{color:#647084}.lead{max-width:920px;line-height:1.7}nav{display:flex;gap:12px;margin:24px 0;flex-wrap:wrap}nav a{padding:10px 16px;border:1px solid #dce1e9;border-radius:10px;background:white}.bench{margin:32px 0 48px}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:18px;margin-top:18px}.card{background:white;border:1px solid #dfe4ec;border-radius:14px;padding:20px}.card h3{font-size:18px;margin:0 0 8px}.pill{display:inline-block;background:#eef2f8;color:#4b5b74;padding:4px 9px;border-radius:6px;font-size:12px}.complete{color:#196943;background:#e7f6ed}.running{color:#315cc6;background:#ebf0fc}.unverified{color:#8c5b16;background:#fff2dd}.preview{display:block;width:100%;height:245px;object-fit:contain;background:#f7f8fa;border-radius:9px;margin:18px 0}.placeholder{height:245px;display:flex;align-items:center;justify-content:center;border:1px dashed #dce1e9;border-radius:9px;margin:18px 0;color:#8792a3}.stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}.stat{background:#f7f8fa;border-radius:8px;padding:10px;font-size:13px}.stat b{display:block;font-size:16px;margin-top:4px}.links{display:flex;gap:16px;flex-wrap:wrap;font-size:13px}.source img{max-height:200px;max-width:100%;border-radius:8px}.source{margin:18px 0}#sync{font-size:13px;line-height:1.7}.case{font-size:12px;overflow-wrap:anywhere}.note{font-size:13px;line-height:1.7}
</style></head><body><main>
<a href="index.html">← PixelWorld 总览</a><h1>Image benchmarks</h1>
<p class="lead muted">PhyEditBench TypeE:预测原图中物理事件发生后的状态。OmniPhys:根据物理描述直接生成图片。沿用 PixelWorld Codex harness,输出由代码直接计算 RGB 像素。</p>
<nav><a href="?benchmark=phyeditbench">PhyEditBench · Image edit</a><a href="?benchmark=omniphys">OmniPhys · Text to image</a><a href="?">全部</a><a href="?historical=1">历史 smoke</a></nav>
<p><select id="model"><option value="">所有模型</option></select> <input id="search" placeholder="搜索 case ID" style="padding:8px;border:1px solid #dce1e9;border-radius:8px"></p>
<p id="sync" class="muted">正在读取 HF 最新进度…</p><div id="content"></div>
</main><script>
const base='https://huggingface.co/datasets/HuggingFriends/PixelWorld/resolve/main/';
const escapeText=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
const number=v=>v==null?'—':Number(v).toLocaleString('zh-CN');
const fileUrl=p=>base+p.split('/').map(encodeURIComponent).join('/');
const query=new URLSearchParams(location.search);const selected=query.get('benchmark')==='omniphys_valid'?'omniphys':query.get('benchmark');const historical=query.get('historical')==='1';let lastData=null;const limits={};
const states={complete:'已通过验收',running:'生成中',pending:'待生成',unverified:'待核验'};
function render(data){
lastData=data;const sections=[],modelSelect=document.getElementById('model'),modelValue=modelSelect.value;
const models=new Map(data.benchmarks.flatMap(b=>b.models.map(m=>[m.key,m.label])));
modelSelect.innerHTML='<option value="">所有模型</option>'+[...models].map(([k,l])=>`<option value="${escapeText(k)}">${escapeText(l)}</option>`).join('');modelSelect.value=modelValue;
const needle=document.getElementById('search').value.toLowerCase();
for(const b of data.benchmarks){
if(selected&&selected!==b.id)continue;
const summary=b.models.map(m=>{const c=m.counts||{};return `<tr><th>${escapeText(m.label)}</th><td><b>${number(c.complete)} / ${number(m.expected??m.smoke_total??b.full_cases)}</b></td><td>${number(c.running)}</td><td>${number(c.pending)}</td><td>${number(c.unverified)}</td><td>${number(m.published_cases??m.cases.length)}</td></tr>`}).join('');
const all=b.models.filter(m=>!modelValue||m.key===modelValue).flatMap(m=>(m.cases||[]).filter(r=>!needle||r.case.toLowerCase().includes(needle)).map(r=>[m,r]));const limit=limits[b.id]||24;
const cards=all.slice(0,limit).map(([m,r])=>{
const u=r.usage||{},preview=r.thumbnail_jpg||r.preview_png;
const image=preview?`<a href="${fileUrl(r.preview_png||preview)}" target="_blank" rel="noopener"><img class="preview" loading="lazy" src="${fileUrl(preview)}" alt="${escapeText(m.label)} 输出图片"></a>`:'<div class="placeholder">图片完成验收后自动显示</div>';
const links=[];
if(r.preview_png)links.push(`<a href="${fileUrl(r.preview_png)}" target="_blank" rel="noopener">原尺寸图片 ↗</a>`);
if(r.code)links.push(`<a href="${fileUrl(r.code)}" target="_blank" rel="noopener">生成代码 ↗</a>`);
if(r.record)links.push(`<a href="${fileUrl(r.record)}" target="_blank" rel="noopener">案例与记录 ↗</a>`);
if(r.trace)links.push(`<a href="${fileUrl(r.trace)}" target="_blank" rel="noopener">完整 Trace ↓</a>`);
const input=r.input_png?`<details class="source"><summary>输入原图</summary><a href="${fileUrl(r.input_png)}" target="_blank" rel="noopener"><img loading="lazy" src="${fileUrl(r.input_png)}" alt="输入原图"></a></details>`:'';
const phase=preview&&r.state!=='complete'?'候选预览 · 未验收':states[r.state]||'待核验';
return `<article class="card"><h3>${escapeText(m.label)}</h3><span class="pill ${escapeText(r.state)}">${phase}</span>${image}${input}<p class="case muted">${escapeText(r.case)} · ${r.width} × ${r.height}</p><div class="stats"><div class="stat">Input tokens<b>${number(u.input_tokens)}</b></div><div class="stat">Output tokens<b>${number(u.output_tokens)}</b></div><div class="stat">Cached input<b>${number(u.cached_input_tokens)}</b></div><div class="stat">耗时<b>${r.duration_seconds==null?'—':(r.duration_seconds/60).toFixed(1)+' 分钟'}</b></div></div><div class="links">${links.join('')}</div></article>`;
}).join('');
const body=`<h2>${escapeText(b.title)}</h2><p class="muted">${escapeText(b.description)}</p><p class="note muted">${data.mode==='full'?'全量实验 · 每模型 '+b.full_cases+' 条 · 官方评分待进行':'历史 smoke,保留原始记录'}。生成完成与图片上传分别统计。</p><div style="overflow:auto"><table style="width:100%;background:white;border-collapse:collapse;text-align:left"><thead><tr><th>模型</th><th>完成 / 总数</th><th>运行</th><th>待生成</th><th>未交付 / 待核验</th><th>图片已同步</th></tr></thead><tbody>${summary}</tbody></table></div><p class="muted note">显示 ${Math.min(limit,all.length)} / ${all.length} 个已同步案例,可筛选模型或搜索 ID。</p><div class="grid">${cards}</div>${all.length>limit?`<button class="more" data-bench="${escapeText(b.id)}" style="padding:10px;margin-top:16px">显示更多案例</button>`:''}`;
sections.push(b.historical?`<details class="bench"><summary>历史 smoke</summary>${body}</details>`:`<section class="bench">${body}</section>`);
}
document.getElementById('content').innerHTML=sections.join('');
document.querySelectorAll('.more').forEach(b=>b.onclick=()=>{limits[b.dataset.bench]=(limits[b.dataset.bench]||24)+24;render(lastData)});
document.getElementById('sync').textContent='最新数据:'+new Date(data.source_updated_utc||data.updated_utc).toLocaleString('zh-CN')+' · 页面每 30 秒读取 HF 更新';
}
document.getElementById('model').onchange=()=>{for(const k in limits)delete limits[k];if(lastData)render(lastData)};
document.getElementById('search').oninput=()=>{for(const k in limits)delete limits[k];if(lastData)render(lastData)};
let busy=false;
async function refresh(){if(busy)return;busy=true;try{const r=await fetch(base+(historical?'live/image_benchmarks_historical_20261203.json':'live/image_benchmarks_progress.json')+'?_='+Date.now(),{cache:'no-store'});if(!r.ok)throw new Error('HF 暂未返回进度');const d=await r.json();if(d.schema!=='pixelworld-image-benchmarks-v1')throw new Error('进度格式不匹配');render(d);}catch(e){document.getElementById('sync').textContent='正在重试读取进度:'+e.message;}finally{busy=false;}}
refresh();setInterval(refresh,30000);document.addEventListener('visibilitychange',()=>{if(!document.hidden)refresh();});
</script></body></html>