Spaces:
Sleeping
Sleeping
Upload static/index.html with huggingface_hub
Browse files- static/index.html +68 -0
static/index.html
CHANGED
|
@@ -210,6 +210,31 @@
|
|
| 210 |
</div>
|
| 211 |
</div>
|
| 212 |
<div class="done-banner" id="done-banner">β
Episode Complete!</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
</div>
|
| 214 |
<div class="panel">
|
| 215 |
<div class="panel-title">π Action Log</div>
|
|
@@ -354,6 +379,8 @@
|
|
| 354 |
'<div style="color:#8892b0;font-size:13px;">Reset first to enable actions</div>';
|
| 355 |
document.getElementById('shape-badge').textContent = 'β reset to load';
|
| 356 |
document.getElementById('done-banner').style.display = 'none';
|
|
|
|
|
|
|
| 357 |
document.getElementById('message-log').innerHTML =
|
| 358 |
'<div class="log-entry info">Ready β click Reset Environment</div>';
|
| 359 |
}
|
|
@@ -422,6 +449,7 @@
|
|
| 422 |
if (data.done) {
|
| 423 |
episodeDone = true;
|
| 424 |
document.getElementById('done-banner').style.display = 'block';
|
|
|
|
| 425 |
addLog('Episode complete! Final score: ' + rew.total.toFixed(4), 'success');
|
| 426 |
updateActions(obs.available_operations, true);
|
| 427 |
}
|
|
@@ -469,6 +497,7 @@
|
|
| 469 |
|
| 470 |
function updateReward(rew) {
|
| 471 |
const total = rew.total || 0;
|
|
|
|
| 472 |
document.getElementById('reward-number').textContent = total.toFixed(4);
|
| 473 |
let color = '#e74c3c';
|
| 474 |
if (total >= 0.8) color = '#2ecc71';
|
|
@@ -498,6 +527,45 @@
|
|
| 498 |
log.scrollTop = log.scrollHeight;
|
| 499 |
}
|
| 500 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 501 |
async function loadLeaderboard() {
|
| 502 |
try {
|
| 503 |
const r = await fetch(BASE + '/leaderboard');
|
|
|
|
| 210 |
</div>
|
| 211 |
</div>
|
| 212 |
<div class="done-banner" id="done-banner">β
Episode Complete!</div>
|
| 213 |
+
|
| 214 |
+
<!-- Submit to leaderboard -->
|
| 215 |
+
<div id="submit-section" style="display:none;margin-top:12px;">
|
| 216 |
+
<div style="font-size:12px;color:#8892b0;margin-bottom:8px;">
|
| 217 |
+
π
Submit your score to leaderboard:
|
| 218 |
+
</div>
|
| 219 |
+
<div style="display:flex;gap:8px;">
|
| 220 |
+
<input
|
| 221 |
+
id="model-name-input"
|
| 222 |
+
type="text"
|
| 223 |
+
placeholder="Your model/name (e.g. gpt-4o-mini)"
|
| 224 |
+
style="flex:1;background:#0f1117;border:1px solid #2d3561;
|
| 225 |
+
border-radius:6px;padding:8px 12px;color:#e0e0e0;
|
| 226 |
+
font-size:13px;outline:none;"
|
| 227 |
+
/>
|
| 228 |
+
<button
|
| 229 |
+
onclick="submitToLeaderboard()"
|
| 230 |
+
style="background:#2ecc71;color:#000;border:none;
|
| 231 |
+
border-radius:6px;padding:8px 16px;cursor:pointer;
|
| 232 |
+
font-weight:bold;font-size:13px;">
|
| 233 |
+
Submit
|
| 234 |
+
</button>
|
| 235 |
+
</div>
|
| 236 |
+
<div id="submit-msg" style="font-size:11px;margin-top:6px;"></div>
|
| 237 |
+
</div>
|
| 238 |
</div>
|
| 239 |
<div class="panel">
|
| 240 |
<div class="panel-title">π Action Log</div>
|
|
|
|
| 379 |
'<div style="color:#8892b0;font-size:13px;">Reset first to enable actions</div>';
|
| 380 |
document.getElementById('shape-badge').textContent = 'β reset to load';
|
| 381 |
document.getElementById('done-banner').style.display = 'none';
|
| 382 |
+
document.getElementById('submit-section').style.display = 'none';
|
| 383 |
+
document.getElementById('submit-msg').textContent = '';
|
| 384 |
document.getElementById('message-log').innerHTML =
|
| 385 |
'<div class="log-entry info">Ready β click Reset Environment</div>';
|
| 386 |
}
|
|
|
|
| 449 |
if (data.done) {
|
| 450 |
episodeDone = true;
|
| 451 |
document.getElementById('done-banner').style.display = 'block';
|
| 452 |
+
document.getElementById('submit-section').style.display = 'block';
|
| 453 |
addLog('Episode complete! Final score: ' + rew.total.toFixed(4), 'success');
|
| 454 |
updateActions(obs.available_operations, true);
|
| 455 |
}
|
|
|
|
| 497 |
|
| 498 |
function updateReward(rew) {
|
| 499 |
const total = rew.total || 0;
|
| 500 |
+
finalReward = total;
|
| 501 |
document.getElementById('reward-number').textContent = total.toFixed(4);
|
| 502 |
let color = '#e74c3c';
|
| 503 |
if (total >= 0.8) color = '#2ecc71';
|
|
|
|
| 527 |
log.scrollTop = log.scrollHeight;
|
| 528 |
}
|
| 529 |
|
| 530 |
+
// Track final reward for submission
|
| 531 |
+
let finalReward = 0.0;
|
| 532 |
+
|
| 533 |
+
async function submitToLeaderboard() {
|
| 534 |
+
const modelName = document.getElementById('model-name-input').value.trim();
|
| 535 |
+
if (!modelName) {
|
| 536 |
+
document.getElementById('submit-msg').style.color = '#e74c3c';
|
| 537 |
+
document.getElementById('submit-msg').textContent = 'β Please enter your model/name first!';
|
| 538 |
+
return;
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
const entry = {
|
| 542 |
+
model_name: modelName,
|
| 543 |
+
task_id: currentTask,
|
| 544 |
+
score: finalReward,
|
| 545 |
+
steps: stepCount
|
| 546 |
+
};
|
| 547 |
+
|
| 548 |
+
try {
|
| 549 |
+
const r = await fetch(BASE + '/leaderboard/submit', {
|
| 550 |
+
method: 'POST',
|
| 551 |
+
headers: {'Content-Type': 'application/json'},
|
| 552 |
+
body: JSON.stringify(entry)
|
| 553 |
+
});
|
| 554 |
+
const data = await r.json();
|
| 555 |
+
if (data.status === 'submitted') {
|
| 556 |
+
document.getElementById('submit-msg').style.color = '#2ecc71';
|
| 557 |
+
document.getElementById('submit-msg').textContent =
|
| 558 |
+
'β
Score ' + finalReward.toFixed(4) + ' submitted for ' + modelName + '!';
|
| 559 |
+
addLog('Submitted to leaderboard: ' + modelName + ' = ' + finalReward.toFixed(4), 'success');
|
| 560 |
+
// Refresh leaderboard
|
| 561 |
+
setTimeout(loadLeaderboard, 1000);
|
| 562 |
+
}
|
| 563 |
+
} catch(e) {
|
| 564 |
+
document.getElementById('submit-msg').style.color = '#e74c3c';
|
| 565 |
+
document.getElementById('submit-msg').textContent = 'β Submit failed: ' + e.message;
|
| 566 |
+
}
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
async function loadLeaderboard() {
|
| 570 |
try {
|
| 571 |
const r = await fetch(BASE + '/leaderboard');
|