Spaces:
Running
Running
File size: 4,225 Bytes
23d1768 90d084f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 'use strict';
const $=id=>document.getElementById(id);
const esc=s=>String(s??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
const source=repo=>'https://huggingface.co/datasets/'+repo.split('/').map(encodeURIComponent).join('/');
let records=[],catalogue=[],collection='benchmark',page=0;const pageSize=25;
const number=n=>new Intl.NumberFormat('en').format(n);
const probability=p=>p==null?'—':`<span class="prob"><span class="track" aria-hidden="true"><i style="width:${p*100}%"></i></span>${p.toFixed(3)}</span>`;
function render(){
const q=$('search').value.toLowerCase().trim(),a=$('model-a').value,b=$('model-b').value,filter=$('filter').value;
let result=(collection==='benchmark'?records:catalogue).filter(r=>JSON.stringify([r.task,r.tasks,r.source,r.repo,r.group,r.robot]).toLowerCase().includes(q));
if(collection==='benchmark')result=result.filter(r=>{
if($('suite').value!=='all'&&r.suite!==$('suite').value)return false;
if(filter==='unclear')return r.label==='unclear';
if(filter==='wrong'){const p=r.predictions['RoboJev-27B'];return r.scored&&p!=null&&((p>=.5)!==(r.label==='success'));}
if(filter==='disagree'){const x=r.predictions[a],y=r.predictions[b];return x!=null&&y!=null&&((x>=.5)!==(y>=.5));}
return true;
});
const pages=Math.max(1,Math.ceil(result.length/pageSize));page=Math.min(page,pages-1);
$('count').textContent=number(result.length)+(collection==='benchmark'?' matching episodes':' matching datasets');
$('page').textContent=`Page ${page+1} of ${pages}`;$('previous').disabled=page===0;$('next').disabled=page===pages-1;
if(!result.length){$('table').innerHTML='<div class="empty">No matches. Try a different search or filter.</div>';return;}
const head=collection==='benchmark'?`<tr><th>Task / source</th><th>Human label</th><th class="numeric">${esc(a)}<br>P(success)</th><th class="numeric">${esc(b)}<br>P(success)</th></tr>`:'<tr><th>Dataset / tasks</th><th>Robot</th><th class="numeric">Episodes sampled</th><th class="numeric">Video hours</th></tr>';
const body=result.slice(page*pageSize,(page+1)*pageSize).map(r=>collection==='benchmark'?`<tr><td>${esc(r.task)}<small class="source">${esc(r.suite)} · ${esc(r.group)} · episode ${esc(r.episode)}</small><a class="source" href="${source(r.source)}" target="_blank" rel="noopener">${esc(r.source)} ↗</a></td><td><span class="badge">${esc(r.label)}</span></td><td class="numeric">${probability(r.predictions[a])}</td><td class="numeric">${probability(r.predictions[b])}</td></tr>`:`<tr><td><a href="${source(r.repo)}" target="_blank" rel="noopener">${esc(r.repo)} ↗</a><small class="source">${esc(r.tasks.join(' · '))}</small></td><td>${esc(r.robot)}</td><td class="numeric">${number(r.episodes)}</td><td class="numeric">${(r.seconds/3600).toFixed(2)}</td></tr>`).join('');
$('table').innerHTML=`<table><thead>${head}</thead><tbody>${body}</tbody></table>`;
}
function switchTo(next){collection=next;page=0;for(const name of ['benchmark','catalogue']){$(name+'-tab').setAttribute('aria-pressed',String(name===next));$(name+'-intro').hidden=name!==next;}document.querySelectorAll('.bench-only').forEach(el=>el.hidden=next!=='benchmark');render();}
$('benchmark-tab').onclick=()=>switchTo('benchmark');$('catalogue-tab').onclick=()=>switchTo('catalogue');
for(const id of ['search','suite','filter','model-a','model-b'])$(id).addEventListener(id==='search'?'input':'change',()=>{page=0;render();});
$('previous').onclick=()=>{page--;render();};$('next').onclick=()=>{page++;render();};
Promise.all(['benchmark.json','catalogue.json','summary.json'].map(async url=>{const r=await fetch(url);if(!r.ok)throw new Error('HTTP '+r.status);return r.json();})).then(([r,c,s])=>{
records=r;catalogue=c;
for(const id of ['model-a','model-b'])for(const [name,metric]of Object.entries(s.metrics)){const o=document.createElement('option');o.value=name;o.textContent=`${name} · ${metric.protocol}`;$(id).append(o);}
$('model-a').value='RoboJev-27B';$('model-b').value='GPT-6 Astra';render();
}).catch(()=>{$('count').textContent='Unable to load the data.';$('table').innerHTML='<div class="empty error">Please reload the page, or use the download links above.</div>';});
|