Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1342,6 +1342,12 @@ def render_timeline(task_id):
|
|
| 1342 |
|
| 1343 |
|
| 1344 |
_RAW_LOG_CSS = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1345 |
.raw-log{max-height:420px;overflow:auto;background:#101226;color:#dfe3ff;border-radius:10px;
|
| 1346 |
padding:12px 14px;font-family:ui-monospace,'SF Mono',Menlo,monospace;font-size:11px;line-height:1.55;
|
| 1347 |
white-space:pre-wrap;word-break:break-word;margin:0}
|
|
@@ -1351,14 +1357,24 @@ def _pre(text):
|
|
| 1351 |
"""Instantly-rendered raw-log panel (gr.Code never mounts inside a closed Accordion)."""
|
| 1352 |
return f'<pre class="raw-log">{html.escape(text)}</pre>'
|
| 1353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1354 |
def show(task_id):
|
| 1355 |
t = BY_ID[task_id]
|
| 1356 |
return (info_card(t),
|
| 1357 |
t["swift"],
|
| 1358 |
artifact(task_id, "run.mp4"),
|
| 1359 |
render_timeline(task_id),
|
| 1360 |
-
|
| 1361 |
-
_pre(_read(artifact(task_id, "trajectory.jsonl")) or "(no trajectory.jsonl)"))
|
| 1362 |
|
| 1363 |
# Helper to construct callback functions avoiding closure-scoping issues
|
| 1364 |
def make_click_fn(task_id):
|
|
@@ -1757,11 +1773,7 @@ with gr.Blocks(title="SiriBench — iOS agent tasks & trajectories") as demo:
|
|
| 1757 |
'independent re-read of the real device data.</p>')
|
| 1758 |
timeline = gr.HTML()
|
| 1759 |
|
| 1760 |
-
|
| 1761 |
-
traj = gr.HTML()
|
| 1762 |
-
|
| 1763 |
-
with gr.Accordion("📄 Raw event log (trajectory.jsonl)", open=False):
|
| 1764 |
-
jsonl = gr.HTML()
|
| 1765 |
|
| 1766 |
# Mapping dictionary of visual button hooks to bind triggers
|
| 1767 |
task_buttons = {
|
|
@@ -1786,7 +1798,7 @@ with gr.Blocks(title="SiriBench — iOS agent tasks & trajectories") as demo:
|
|
| 1786 |
btn.click(fn=make_click_fn(task_id), outputs=picker)
|
| 1787 |
|
| 1788 |
# Dropdown trigger updates all visualization panels
|
| 1789 |
-
outs = [info, swift, video, timeline,
|
| 1790 |
picker.change(show, picker, outs)
|
| 1791 |
demo.load(show, picker, outs)
|
| 1792 |
|
|
|
|
| 1342 |
|
| 1343 |
|
| 1344 |
_RAW_LOG_CSS = """
|
| 1345 |
+
details.raw-acc{background:#fff;border:1px solid #e2e2ef;border-radius:12px;margin-top:12px;
|
| 1346 |
+
padding:10px 16px;box-shadow:0 1px 2px rgba(30,27,75,.05)}
|
| 1347 |
+
details.raw-acc summary{cursor:pointer;font-weight:600;font-size:14px;color:#1f1a3a;
|
| 1348 |
+
list-style-position:inside;padding:2px 0}
|
| 1349 |
+
details.raw-acc[open] summary{margin-bottom:9px}
|
| 1350 |
+
|
| 1351 |
.raw-log{max-height:420px;overflow:auto;background:#101226;color:#dfe3ff;border-radius:10px;
|
| 1352 |
padding:12px 14px;font-family:ui-monospace,'SF Mono',Menlo,monospace;font-size:11px;line-height:1.55;
|
| 1353 |
white-space:pre-wrap;word-break:break-word;margin:0}
|
|
|
|
| 1357 |
"""Instantly-rendered raw-log panel (gr.Code never mounts inside a closed Accordion)."""
|
| 1358 |
return f'<pre class="raw-log">{html.escape(text)}</pre>'
|
| 1359 |
|
| 1360 |
+
|
| 1361 |
+
def _raw_details(task_id):
|
| 1362 |
+
"""Native <details> collapsibles — Gradio Accordions lazy-render their children
|
| 1363 |
+
and the re-hydration event 422s in Gradio 6, leaving an eternal spinner."""
|
| 1364 |
+
txt = _read(artifact(task_id, "trajectory.txt")) or "(no trajectory.txt in this Space)"
|
| 1365 |
+
jl = _read(artifact(task_id, "trajectory.jsonl")) or "(no trajectory.jsonl)"
|
| 1366 |
+
return (
|
| 1367 |
+
f'<details class="raw-acc"><summary>📜 Raw model transcript (trajectory.txt)</summary>{_pre(txt)}</details>'
|
| 1368 |
+
f'<details class="raw-acc"><summary>📄 Raw event log (trajectory.jsonl)</summary>{_pre(jl)}</details>'
|
| 1369 |
+
)
|
| 1370 |
+
|
| 1371 |
def show(task_id):
|
| 1372 |
t = BY_ID[task_id]
|
| 1373 |
return (info_card(t),
|
| 1374 |
t["swift"],
|
| 1375 |
artifact(task_id, "run.mp4"),
|
| 1376 |
render_timeline(task_id),
|
| 1377 |
+
_raw_details(task_id))
|
|
|
|
| 1378 |
|
| 1379 |
# Helper to construct callback functions avoiding closure-scoping issues
|
| 1380 |
def make_click_fn(task_id):
|
|
|
|
| 1773 |
'independent re-read of the real device data.</p>')
|
| 1774 |
timeline = gr.HTML()
|
| 1775 |
|
| 1776 |
+
rawlogs = gr.HTML()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1777 |
|
| 1778 |
# Mapping dictionary of visual button hooks to bind triggers
|
| 1779 |
task_buttons = {
|
|
|
|
| 1798 |
btn.click(fn=make_click_fn(task_id), outputs=picker)
|
| 1799 |
|
| 1800 |
# Dropdown trigger updates all visualization panels
|
| 1801 |
+
outs = [info, swift, video, timeline, rawlogs]
|
| 1802 |
picker.change(show, picker, outs)
|
| 1803 |
demo.load(show, picker, outs)
|
| 1804 |
|