Download index.html from DorianAtSchool/RoboTalk-Explorer: direct link, hf CLI and curl.
- Browser
- Download file 13.2 kB
-
https://huggingface.co/spaces/DorianAtSchool/RoboTalk-Explorer/resolve/main/index.html
- Command line
-
hf download hf://spaces/DorianAtSchool/RoboTalk-Explorer/index.html
-
curl -L -o index.html https://huggingface.co/spaces/DorianAtSchool/RoboTalk-Explorer/resolve/main/index.html
13.2 kB
| <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <title>RoboTalk Explorer</title> | |
| <style> | |
| :root{--ink:#202631;--muted:#647084;--line:#d8dee7;--blue:#3976d2;--panel:#f7f9fb}*{box-sizing:border-box}body{font:15px system-ui,sans-serif;color:var(--ink);margin:0;background:#fff}main{max-width:1500px;margin:auto;padding:24px}h1{margin:0 0 4px}.sub{color:var(--muted);margin:0 0 20px}.filters{display:grid;grid-template-columns:1fr 1fr;gap:12px;background:var(--panel);padding:14px;border:1px solid var(--line);border-radius:10px}label{font-size:12px;color:var(--muted);display:block}select,input{width:100%;margin-top:5px;padding:8px}.tick-control{display:grid;grid-template-columns:1fr auto;align-items:end;gap:10px;margin:14px 0}.tick-control label{margin:0}.tick-buttons,.detail-buttons{display:flex;gap:7px}.tick-control button,.detail-buttons button,.dialog-close{border:0;border-radius:7px;background:var(--blue);color:#fff;font-weight:650;cursor:pointer}.tick-control button{width:42px;height:38px;font-size:20px;line-height:1}.tick-control button:disabled{background:#aeb7c5;cursor:default}.summary{margin:18px 0}.detail-buttons{margin:-8px 0 18px}.detail-buttons button,.dialog-close{padding:8px 13px}dialog{width:min(900px,92vw);max-height:85vh;border:1px solid var(--line);border-radius:10px;padding:20px}dialog::backdrop{background:#20263199}.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:16px}.dialog-head h2{margin:0}.dialog-content{max-height:65vh;overflow:auto;white-space:pre-wrap}.views{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px}.agent{border:1px solid var(--line);border-radius:10px;overflow:hidden}.agent h3,.agent .text,.agent .view-select{padding:0 12px}.agent img{display:block;width:100%;height:280px;object-fit:contain;background:#15191f}.view-note{font-size:11px;color:var(--muted);min-height:16px}.tool{color:var(--blue);font-weight:700}pre{white-space:pre-wrap;word-break:break-word;font-size:12px;background:var(--panel);padding:9px;border-radius:6px}table{border-collapse:collapse;width:100%;margin-top:18px;font-size:12px}th,td{border:1px solid var(--line);padding:7px;vertical-align:top}th{background:var(--panel);position:sticky;top:0}.selected{background:#eaf2ff}@media(max-width:900px){.filters,.views{grid-template-columns:1fr}.agent img{height:240px}} | |
| </style></head><body><main> | |
| <h1>RoboTalk Explorer</h1><p class="sub">Explore two-agent embodied coordination trajectories one concurrent tick at a time.</p> | |
| <div class="filters"><label>Task<select id="task"></select></label><label>Trajectory<select id="trajectory"></select></label></div> | |
| <div class="tick-control"><label>Tick <span id="tickLabel"></span><input id="tick" type="range" min="0" value="0" step="1"></label><div class="tick-buttons"><button id="prevTick" type="button" aria-label="Previous tick" title="Previous tick">←</button><button id="nextTick" type="button" aria-label="Next tick" title="Next tick">→</button></div></div> | |
| <div id="summary" class="summary"></div> | |
| <div class="detail-buttons"><button id="showPrompt" type="button">View prompt</button><button id="showState" type="button">View initial state</button><button id="exportTrajectory" type="button">Export trajectory</button><button id="exportMetadata" type="button">Export metadata</button><button id="exportPrompt" type="button">Export prompt</button><button id="exportVisuals" type="button">Export visuals</button></div> | |
| <div class="views"> | |
| <section class="agent"><h3>Agent 0 view</h3><label class="view-select">Camera<select id="view0"><option value="agentview_center">Center</option><option value="agentview_left">Left</option><option value="agentview_right">Right</option><option value="wrist">Wrist</option></select></label><p id="note0" class="view-select view-note"></p><img id="img0"><div id="text0" class="text"></div></section> | |
| <section class="agent"><h3>Agent 1 view</h3><label class="view-select">Camera<select id="view1"><option value="agentview_center">Center</option><option value="agentview_left">Left</option><option value="agentview_right">Right</option><option value="wrist">Wrist</option></select></label><p id="note1" class="view-select view-note"></p><img id="img1"><div id="text1" class="text"></div></section> | |
| <section class="agent"><h3>Global view</h3><label class="view-select">Camera<select id="globalView"><option value="top_view">Top</option><option value="room_view">Room</option><option value="map">Map</option></select></label><p id="globalNote" class="view-select view-note"></p><img id="globalImg"><div class="text"><p>Global scene context from the latest available <code>get_image</code> result.</p></div></section> | |
| </div> | |
| <dialog id="detailDialog"><div class="dialog-head"><h2 id="dialogTitle"></h2><button class="dialog-close" id="closeDialog" type="button">Close</button></div><pre id="dialogContent" class="dialog-content"></pre></dialog> | |
| <table><thead><tr><th>Tick</th><th>Agent 0 tool</th><th>Agent 0 arguments</th><th>Agent 1 tool</th><th>Agent 1 arguments</th></tr></thead><tbody id="grid"></tbody></table> | |
| </main><script> | |
| const esc=s=>String(s??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); | |
| const DATASET_BASE='https://huggingface.co/datasets/DorianAtSchool/RoboTalk/resolve/v1.1/'; | |
| let catalog=[],episodeRows=[],mediaUrls={},promptGuide='';const byId=id=>document.getElementById(id); | |
| function parseTar(buffer){const bytes=new Uint8Array(buffer),decoder=new TextDecoder(),files={};let offset=0;while(offset+512<=bytes.length){const header=bytes.subarray(offset,offset+512),name=decoder.decode(header.subarray(0,100)).replace(/\0.*$/,'');if(!name)break;const size=parseInt(decoder.decode(header.subarray(124,136)).replace(/\0.*$/,'').trim(),8)||0,start=offset+512;const type=name.endsWith('.png')?'image/png':'image/jpeg';files[name]=URL.createObjectURL(new Blob([bytes.slice(start,start+size)],{type}));offset=start+Math.ceil(size/512)*512}return files} | |
| function clearMedia(){Object.values(mediaUrls).forEach(URL.revokeObjectURL);mediaUrls={}} | |
| const imageUrl=path=>path?(mediaUrls[path]||''):''; | |
| function setTasks(){const ts=[...new Set(catalog.map(x=>x.task))].sort();byId('task').innerHTML=ts.map(x=>`<option>${esc(x)}</option>`).join('');setTrajectories()} | |
| function setTrajectories(){const task=byId('task').value, es=catalog.filter(x=>x.task===task);byId('trajectory').innerHTML=es.map(x=>`<option value="${esc(x.episode_key)}">${esc(x.trajectory_id)}</option>`).join('');setEpisode().catch(showLoadError)} | |
| function showLoadError(error){byId('summary').innerHTML=`<b>Could not load this trajectory.</b><br>${esc(error.message)}. The trajectory images could not be fetched from the RoboTalk dataset; try reloading.`} | |
| function observationLabel(raw){const calls=JSON.parse(raw||'[]');return calls.length?calls.map(x=>`get_image(views=[${x.views.join(', ')}])`).join('<br>'):'No new get_image call this tick'} | |
| async function setEpisode(){const key=byId('trajectory').value,m=catalog.find(x=>x.episode_key===key);byId('summary').textContent='Loading trajectory…';clearMedia();const [rows,archive]=await Promise.all([fetch(`data/episodes/${encodeURIComponent(key)}.json`).then(r=>{if(!r.ok)throw new Error(`Could not load ${key}`);return r.json()}),fetch(`${DATASET_BASE}media_archives/${encodeURIComponent(key)}.tar`).then(r=>{if(!r.ok)throw new Error(`Could not load media for ${key}`);return r.arrayBuffer()})]);episodeRows=rows;mediaUrls=parseTar(archive);episodeRows.sort((a,b)=>a.tick-b.tick);byId('tick').max=Math.max(0,episodeRows.length-1);byId('tick').value=0;byId('summary').innerHTML=`<b>${esc(m.task)}</b> · ${esc(m.trajectory_id)} · ${m.num_ticks} action ticks · coordinator ${esc(m.coordinator_id)} · ${m.communication_calls} messages · maximum physical-work share ${(100*m.max_agent_work_share).toFixed(0)}%<br>${esc(m.task_instruction)}`;byId('grid').innerHTML=episodeRows.map((r,i)=>`<tr id="row${i}"><td>${esc(r.tick_label??r.tick)}</td><td><small>${observationLabel(r.agent_0_observation_calls)}</small><br><b>${esc(r.agent_0_tool)}</b></td><td><code>${esc(r.agent_0_args)}</code></td><td><small>${observationLabel(r.agent_1_observation_calls)}</small><br><b>${esc(r.agent_1_tool)}</b></td><td><code>${esc(r.agent_1_args)}</code></td></tr>`).join('');showTick()} | |
| function agentImage(images,n){const requested=byId(`view${n}`).value;return images[requested]||null} | |
| function agent(row,n){const tool=row[`agent_${n}_tool`],args=row[`agent_${n}_args`],reason=row[`agent_${n}_reasoning`],images=JSON.parse(row[`agent_${n}_images`]||'{}'),img=agentImage(images,n),obs=observationLabel(row[`agent_${n}_observation_calls`]);byId(`img${n}`).src=imageUrl(img);byId(`img${n}`).alt=img?'Latest selected view':'No image produced yet';byId(`note${n}`).textContent=img?'':'No image produced yet.';byId(`text${n}`).innerHTML=`<p><b>Observation call</b><br>${obs}</p><p class="tool">${esc(tool)}</p><pre>${esc(args)}</pre><details><summary>Reasoning</summary><p>${esc(reason)}</p></details>`} | |
| function globalView(row){const requested=byId('globalView').value,a0=JSON.parse(row.agent_0_images||'{}'),a1=JSON.parse(row.agent_1_images||'{}'),img=a0[requested]||a1[requested];byId('globalImg').src=imageUrl(img);byId('globalImg').alt=img?`Latest ${requested}`:'No image produced yet';byId('globalNote').textContent=img?'':'No image produced yet.'} | |
| function showTick(){const i=+byId('tick').value,r=episodeRows[i];if(!r)return;byId('tickLabel').textContent=r.tick_label==='Task result'?'Task result':`${r.tick_label??r.tick} / ${episodeRows.filter(x=>x.tick_label!=='Task result').at(-1).tick}`;byId('prevTick').disabled=i<=0;byId('nextTick').disabled=i>=episodeRows.length-1;agent(r,0);agent(r,1);globalView(r);document.querySelectorAll('tbody tr').forEach(x=>x.classList.remove('selected'));byId(`row${i}`)?.classList.add('selected')} | |
| function prevTick(){const slider=byId('tick');if(+slider.value>0){slider.value=+slider.value-1;showTick()}} | |
| function nextTick(){const slider=byId('tick');if(+slider.value<+slider.max){slider.value=+slider.value+1;showTick()}} | |
| function openDetail(title,content){byId('dialogTitle').textContent=title;byId('dialogContent').textContent=content;byId('detailDialog').showModal()} | |
| function selectedMetadata(){return catalog.find(x=>x.episode_key===byId('trajectory').value)} | |
| function promptText(m=selectedMetadata()){const episode=`SELECTED TRAJECTORY\n\nTask family: ${m?.task||''}\nTask goal instruction: ${m?.task_instruction||''}\nCoordinator: ${m?.coordinator_id||''}\n\n`;return episode+(promptGuide||'Prompt guide unavailable.')} | |
| function showPrompt(){openDetail('Prompt and task goal',promptText())} | |
| function showState(){const m=catalog.find(x=>x.episode_key===byId('trajectory').value);let state=m?.initial_state||'{}';try{state=JSON.stringify(JSON.parse(state),null,2)}catch{}openDetail(`Initial state · ${m?.trajectory_id||''}`,state)} | |
| function parseJson(value){try{return JSON.parse(value)}catch{return value}} | |
| function normalizedMetadata(m){return {...m,initial_state:parseJson(m.initial_state)}} | |
| function normalizedTick(row){const result={...row};for(const key of ['agent_0_args','agent_1_args','agent_0_observation_calls','agent_1_observation_calls','agent_0_images','agent_1_images'])result[key]=parseJson(result[key]);return result} | |
| function downloadBlob(filename,content,type){const url=URL.createObjectURL(new Blob([content],{type})),a=document.createElement('a');a.href=url;a.download=filename;a.click();setTimeout(()=>URL.revokeObjectURL(url),1000)} | |
| function exportTrajectory(){const m=selectedMetadata(),ticks=episodeRows.map(row=>({...normalizedTick(row),task_instruction:m.task_instruction})),bundle={schema_version:1,metadata:normalizedMetadata(m),prompt:promptText(m),ticks};downloadBlob(`${m.episode_key}.json`,JSON.stringify(bundle,null,2),'application/json')} | |
| function exportMetadata(){const m=selectedMetadata();downloadBlob(`${m.episode_key}_metadata.json`,JSON.stringify(normalizedMetadata(m),null,2),'application/json')} | |
| function exportPrompt(){const m=selectedMetadata();downloadBlob(`${m.episode_key}_prompt.txt`,promptText(m),'text/plain')} | |
| function exportVisuals(){const m=selectedMetadata(),a=document.createElement('a');a.href=`${DATASET_BASE}${m.media_archive}?download=true`;a.download=`${m.episode_key}_visuals.tar`;a.target='_blank';a.click()} | |
| Promise.all([fetch('data/trajectories.json').then(r=>r.json()),fetch('prompt_guide.txt').then(r=>r.text())]).then(([rows,guide])=>{catalog=rows;promptGuide=guide;setTasks()}); | |
| byId('task').onchange=setTrajectories;byId('trajectory').onchange=()=>setEpisode().catch(showLoadError);byId('tick').oninput=showTick;byId('prevTick').onclick=prevTick;byId('nextTick').onclick=nextTick;byId('view0').onchange=showTick;byId('view1').onchange=showTick;byId('globalView').onchange=showTick; | |
| byId('showPrompt').onclick=showPrompt;byId('showState').onclick=showState;byId('closeDialog').onclick=()=>byId('detailDialog').close(); | |
| byId('exportTrajectory').onclick=exportTrajectory;byId('exportMetadata').onclick=exportMetadata;byId('exportPrompt').onclick=exportPrompt;byId('exportVisuals').onclick=exportVisuals; | |
| </script></body></html> | |