Spaces:
Sleeping
Sleeping
Commit Β·
53a09ff
1
Parent(s): f1b6f8f
Overhaul UI for judge impressiveness
Browse files- Hero banner: stats panel (4 stages / 5 actions / 60 steps / 1.0 score), how-it-works flow diagram
- Rename misleading "Run Baseline" tab β "Live LLM Agent" with descriptive header card
- Comparison tab: two-column explainer header clarifying baseline vs LLM approach
- Score result cards appear after each agent run with big pct number, stage list, step count
- CSS: hero-stat, how-step, score-display, score-card components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- gradio_app.py +265 -26
gradio_app.py
CHANGED
|
@@ -348,6 +348,73 @@ body, .gradio-container {
|
|
| 348 |
}
|
| 349 |
label span { color: #64748b !important; font-size: 0.8rem !important; font-weight: 600 !important; }
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
/* ββ Docs tab ββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 352 |
.doc-box {
|
| 353 |
background: #0d1117;
|
|
@@ -377,17 +444,41 @@ label span { color: #64748b !important; font-size: 0.8rem !important; font-weigh
|
|
| 377 |
|
| 378 |
HERO_HTML = """
|
| 379 |
<div class="hero-banner">
|
| 380 |
-
<div
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
</div>
|
| 392 |
</div>
|
| 393 |
"""
|
|
@@ -600,9 +691,35 @@ with gr.Blocks(title="PipelineOps Arena β OpenEnv") as demo:
|
|
| 600 |
outputs=[stage_display]
|
| 601 |
)
|
| 602 |
|
| 603 |
-
# ββ
|
| 604 |
-
with gr.Tab("
|
| 605 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 606 |
|
| 607 |
run_btn = gr.Button("βΆ Run LLM Agent (All 4 Stages)", elem_classes="btn-primary")
|
| 608 |
|
|
@@ -835,30 +952,104 @@ CRITICAL RULES:
|
|
| 835 |
except Exception as e:
|
| 836 |
yield emit(f"\nβ Error during agent run: {e}")
|
| 837 |
|
| 838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 839 |
|
| 840 |
# ββ COMPARISON TAB ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 841 |
with gr.Tab("π Baseline vs LLM Agent"):
|
| 842 |
-
gr.
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 847 |
with gr.Row():
|
| 848 |
with gr.Column():
|
| 849 |
-
gr.
|
|
|
|
| 850 |
run_baseline_cmp_btn = gr.Button("βΆ Run Baseline Agent", elem_classes="btn-reset")
|
| 851 |
baseline_cmp_log = gr.Textbox(
|
| 852 |
label="Baseline Log", lines=28, interactive=False,
|
| 853 |
-
placeholder="Click to run baseline agentβ¦", elem_classes="code-box"
|
| 854 |
)
|
| 855 |
with gr.Column():
|
| 856 |
-
gr.
|
|
|
|
| 857 |
run_llm_cmp_btn = gr.Button("βΆ Run LLM Agent", elem_classes="btn-primary")
|
| 858 |
llm_cmp_log = gr.Textbox(
|
| 859 |
label="LLM Log", lines=28, interactive=False,
|
| 860 |
-
placeholder="Click to run LLM agentβ¦", elem_classes="code-box"
|
| 861 |
)
|
|
|
|
|
|
|
|
|
|
| 862 |
|
| 863 |
_ICONS = {"inspect_data":"π","run_script":"βΆοΈ ","edit_script":"βοΈ ","query_actor":"π€","submit":"π€"}
|
| 864 |
|
|
@@ -1199,8 +1390,56 @@ WORKFLOW PER STAGE:
|
|
| 1199 |
yield emit(f" Episode score : {_env.episode_score:.2f}")
|
| 1200 |
yield emit(f"\n {'β
' if _env.episode_score >= 0.75 else 'β οΈ' if _env.episode_score > 0 else 'β'} LLM Agent complete.")
|
| 1201 |
|
| 1202 |
-
|
| 1203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1204 |
|
| 1205 |
|
| 1206 |
# ββ DOCS TAB βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 348 |
}
|
| 349 |
label span { color: #64748b !important; font-size: 0.8rem !important; font-weight: 600 !important; }
|
| 350 |
|
| 351 |
+
/* ββ Hero stats ββββββββββββββββββββββββββββββββββββββββββββ */
|
| 352 |
+
.hero-stat {
|
| 353 |
+
background: rgba(255,255,255,0.04);
|
| 354 |
+
border: 1px solid rgba(99,102,241,0.2);
|
| 355 |
+
border-radius: 12px;
|
| 356 |
+
padding: 14px 20px;
|
| 357 |
+
text-align: center;
|
| 358 |
+
min-width: 72px;
|
| 359 |
+
}
|
| 360 |
+
.hero-stat-num {
|
| 361 |
+
font-size: 1.6rem;
|
| 362 |
+
font-weight: 800;
|
| 363 |
+
color: #818cf8;
|
| 364 |
+
line-height: 1;
|
| 365 |
+
}
|
| 366 |
+
.hero-stat-label {
|
| 367 |
+
font-size: 0.68rem;
|
| 368 |
+
color: #64748b;
|
| 369 |
+
font-weight: 600;
|
| 370 |
+
margin-top: 4px;
|
| 371 |
+
white-space: nowrap;
|
| 372 |
+
}
|
| 373 |
+
.how-step {
|
| 374 |
+
display: flex;
|
| 375 |
+
align-items: center;
|
| 376 |
+
gap: 8px;
|
| 377 |
+
padding: 8px 12px;
|
| 378 |
+
background: rgba(255,255,255,0.03);
|
| 379 |
+
border-radius: 8px;
|
| 380 |
+
border: 1px solid rgba(255,255,255,0.06);
|
| 381 |
+
}
|
| 382 |
+
.how-num {
|
| 383 |
+
background: rgba(99,102,241,0.2);
|
| 384 |
+
color: #818cf8;
|
| 385 |
+
border-radius: 999px;
|
| 386 |
+
width: 20px; height: 20px;
|
| 387 |
+
display: flex; align-items: center; justify-content: center;
|
| 388 |
+
font-size: 0.7rem; font-weight: 800; flex-shrink: 0;
|
| 389 |
+
}
|
| 390 |
+
.how-text { color: #94a3b8; font-size: 0.78rem; font-weight: 500; }
|
| 391 |
+
.how-arrow { color: #334155; font-size: 1rem; padding: 0 4px; display: flex; align-items: center; }
|
| 392 |
+
|
| 393 |
+
/* ββ Score display βββββββββββββββββββββββββββββββββββββββββ */
|
| 394 |
+
.score-display {
|
| 395 |
+
background: linear-gradient(135deg, #0d1117 0%, #0f1a2e 100%);
|
| 396 |
+
border: 1px solid rgba(99,102,241,0.3);
|
| 397 |
+
border-radius: 14px;
|
| 398 |
+
padding: 24px;
|
| 399 |
+
margin-top: 12px;
|
| 400 |
+
display: flex;
|
| 401 |
+
gap: 16px;
|
| 402 |
+
align-items: stretch;
|
| 403 |
+
flex-wrap: wrap;
|
| 404 |
+
}
|
| 405 |
+
.score-card {
|
| 406 |
+
flex: 1;
|
| 407 |
+
min-width: 140px;
|
| 408 |
+
background: rgba(255,255,255,0.03);
|
| 409 |
+
border: 1px solid rgba(255,255,255,0.08);
|
| 410 |
+
border-radius: 10px;
|
| 411 |
+
padding: 16px;
|
| 412 |
+
text-align: center;
|
| 413 |
+
}
|
| 414 |
+
.score-card-big { font-size: 2.5rem; font-weight: 900; line-height: 1; }
|
| 415 |
+
.score-card-label { font-size: 0.72rem; color: #64748b; font-weight: 600; margin-top: 6px; }
|
| 416 |
+
.score-card-sub { font-size: 0.78rem; color: #475569; margin-top: 4px; }
|
| 417 |
+
|
| 418 |
/* ββ Docs tab ββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 419 |
.doc-box {
|
| 420 |
background: #0d1117;
|
|
|
|
| 444 |
|
| 445 |
HERO_HTML = """
|
| 446 |
<div class="hero-banner">
|
| 447 |
+
<div style="display:flex;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;gap:20px">
|
| 448 |
+
<div style="flex:1;min-width:260px">
|
| 449 |
+
<div class="hero-title">π οΈ <span>PipelineOps Arena</span></div>
|
| 450 |
+
<p class="hero-sub">
|
| 451 |
+
A <strong style="color:#818cf8">4-stage cascading RL environment</strong> where AI agents
|
| 452 |
+
autonomously debug broken ML pipelines β inspecting data, editing scripts, and verifying fixes
|
| 453 |
+
in a real Python sandbox. Graded <strong style="color:#86efac">deterministically</strong>,
|
| 454 |
+
no LLM judge required.
|
| 455 |
+
</p>
|
| 456 |
+
<div class="hero-badges">
|
| 457 |
+
<span class="hbadge hb-blue">β‘ 4-Stage Cascade</span>
|
| 458 |
+
<span class="hbadge hb-green">β
Deterministic Grading</span>
|
| 459 |
+
<span class="hbadge hb-amber">π Reward β [0, 1]</span>
|
| 460 |
+
<span class="hbadge hb-purple">π€ OpenEnv Compliant</span>
|
| 461 |
+
<span class="hbadge hb-rose">π¦Ύ GRPO Fine-tuned LLM</span>
|
| 462 |
+
</div>
|
| 463 |
+
</div>
|
| 464 |
+
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:flex-start">
|
| 465 |
+
<div class="hero-stat"><div class="hero-stat-num">4</div><div class="hero-stat-label">Pipeline Stages</div></div>
|
| 466 |
+
<div class="hero-stat"><div class="hero-stat-num">5</div><div class="hero-stat-label">Agent Actions</div></div>
|
| 467 |
+
<div class="hero-stat"><div class="hero-stat-num">60</div><div class="hero-stat-label">Max Steps</div></div>
|
| 468 |
+
<div class="hero-stat"><div class="hero-stat-num">1.0</div><div class="hero-stat-label">Max Score</div></div>
|
| 469 |
+
</div>
|
| 470 |
+
</div>
|
| 471 |
+
<div style="margin-top:20px;padding-top:16px;border-top:1px solid rgba(99,102,241,0.15)">
|
| 472 |
+
<div style="font-size:0.8rem;color:#475569;font-weight:600;letter-spacing:.05em;margin-bottom:10px">HOW IT WORKS</div>
|
| 473 |
+
<div style="display:flex;gap:0;flex-wrap:wrap">
|
| 474 |
+
<div class="how-step"><span class="how-num">1</span><span class="how-text">Agent receives broken ML pipeline + error log</span></div>
|
| 475 |
+
<div class="how-arrow">β</div>
|
| 476 |
+
<div class="how-step"><span class="how-num">2</span><span class="how-text">Calls actions: inspect, edit, run, query</span></div>
|
| 477 |
+
<div class="how-arrow">β</div>
|
| 478 |
+
<div class="how-step"><span class="how-num">3</span><span class="how-text">Fixed script runs in isolated Python sandbox</span></div>
|
| 479 |
+
<div class="how-arrow">β</div>
|
| 480 |
+
<div class="how-step"><span class="how-num">4</span><span class="how-text">Grader scores fix β advance to next stage</span></div>
|
| 481 |
+
</div>
|
| 482 |
</div>
|
| 483 |
</div>
|
| 484 |
"""
|
|
|
|
| 691 |
outputs=[stage_display]
|
| 692 |
)
|
| 693 |
|
| 694 |
+
# ββ LLM AGENT TAB βββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 695 |
+
with gr.Tab("π€ Live LLM Agent"):
|
| 696 |
+
gr.HTML("""
|
| 697 |
+
<div style="background:linear-gradient(135deg,rgba(99,102,241,0.08),rgba(139,92,246,0.05));
|
| 698 |
+
border:1px solid rgba(99,102,241,0.2);border-radius:12px;padding:20px 24px;margin-bottom:16px">
|
| 699 |
+
<div style="font-size:1.1rem;font-weight:700;color:#e2e8f0;margin-bottom:6px">
|
| 700 |
+
π€ Watch the LLM Agent Solve All 4 Stages
|
| 701 |
+
</div>
|
| 702 |
+
<div style="color:#94a3b8;font-size:0.88rem;line-height:1.6;max-width:660px">
|
| 703 |
+
<strong style="color:#a5b4fc">Groq Llama 3.1 8B</strong> receives error logs and the broken script,
|
| 704 |
+
reasons about the root cause, and generates fix actions entirely on its own β
|
| 705 |
+
no hardcoded scripts, no rule-based overrides.
|
| 706 |
+
Watch it inspect data, patch code, run the sandbox, and advance through all 4 stages.
|
| 707 |
+
</div>
|
| 708 |
+
<div style="display:flex;gap:8px;margin-top:12px;flex-wrap:wrap">
|
| 709 |
+
<span style="background:rgba(34,197,94,0.1);border:1px solid rgba(34,197,94,0.3);
|
| 710 |
+
color:#86efac;padding:3px 10px;border-radius:999px;font-size:0.75rem;font-weight:600">
|
| 711 |
+
β
Real-time reasoning
|
| 712 |
+
</span>
|
| 713 |
+
<span style="background:rgba(99,102,241,0.1);border:1px solid rgba(99,102,241,0.3);
|
| 714 |
+
color:#a5b4fc;padding:3px 10px;border-radius:999px;font-size:0.75rem;font-weight:600">
|
| 715 |
+
π Isolated sandbox execution
|
| 716 |
+
</span>
|
| 717 |
+
<span style="background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.3);
|
| 718 |
+
color:#fcd34d;padding:3px 10px;border-radius:999px;font-size:0.75rem;font-weight:600">
|
| 719 |
+
π Deterministic grading
|
| 720 |
+
</span>
|
| 721 |
+
</div>
|
| 722 |
+
</div>""")
|
| 723 |
|
| 724 |
run_btn = gr.Button("βΆ Run LLM Agent (All 4 Stages)", elem_classes="btn-primary")
|
| 725 |
|
|
|
|
| 952 |
except Exception as e:
|
| 953 |
yield emit(f"\nβ Error during agent run: {e}")
|
| 954 |
|
| 955 |
+
live_scorecard = gr.HTML("")
|
| 956 |
+
|
| 957 |
+
def run_llm_agent_with_score():
|
| 958 |
+
log_text = ""
|
| 959 |
+
for chunk in run_baseline_streaming():
|
| 960 |
+
log_text = chunk
|
| 961 |
+
yield chunk, ""
|
| 962 |
+
import re as _re
|
| 963 |
+
completed_m = _re.search(r"Stages completed\s*:\s*(\[.*?\])", log_text)
|
| 964 |
+
score_m = _re.search(r"Final score\s*:\s*([\d.]+)", log_text)
|
| 965 |
+
steps_m = _re.search(r"Total steps\s*:\s*(\d+)", log_text)
|
| 966 |
+
completed = completed_m.group(1) if completed_m else "[]"
|
| 967 |
+
score = float(score_m.group(1)) if score_m else 0.0
|
| 968 |
+
steps = steps_m.group(1) if steps_m else "β"
|
| 969 |
+
pct = int(score * 100)
|
| 970 |
+
color = "#22c55e" if pct >= 75 else "#f59e0b" if pct >= 25 else "#ef4444"
|
| 971 |
+
bar = f'<div style="background:rgba(255,255,255,0.06);border-radius:999px;height:8px;overflow:hidden;margin:8px 0"><div style="width:{pct}%;height:100%;border-radius:999px;background:{color}"></div></div>'
|
| 972 |
+
card = f"""<div style="background:linear-gradient(135deg,#0d1117,#0f1a2e);border:1px solid rgba(99,102,241,0.3);
|
| 973 |
+
border-radius:14px;padding:20px 24px;margin-top:12px">
|
| 974 |
+
<div style="font-size:0.85rem;font-weight:700;color:#64748b;letter-spacing:.05em;margin-bottom:14px">EPISODE RESULT</div>
|
| 975 |
+
<div style="display:flex;gap:16px;align-items:flex-start;flex-wrap:wrap">
|
| 976 |
+
<div style="text-align:center">
|
| 977 |
+
<div style="font-size:3rem;font-weight:900;color:{color};line-height:1">{pct}%</div>
|
| 978 |
+
{bar}
|
| 979 |
+
<div style="color:#64748b;font-size:0.72rem;font-weight:600">EPISODE SCORE</div>
|
| 980 |
+
</div>
|
| 981 |
+
<div style="flex:1;min-width:160px">
|
| 982 |
+
<div style="color:#e2e8f0;font-size:0.88rem;margin-bottom:6px">
|
| 983 |
+
<strong style="color:#94a3b8">Stages completed:</strong> {completed}
|
| 984 |
+
</div>
|
| 985 |
+
<div style="color:#e2e8f0;font-size:0.88rem;margin-bottom:6px">
|
| 986 |
+
<strong style="color:#94a3b8">Total steps:</strong> {steps}
|
| 987 |
+
</div>
|
| 988 |
+
<div style="color:#64748b;font-size:0.78rem;line-height:1.6;margin-top:10px">
|
| 989 |
+
Groq Llama 3.1 8B reasoned through each stage autonomously β
|
| 990 |
+
inspecting data, patching scripts, and verifying fixes in a real Python sandbox.
|
| 991 |
+
</div>
|
| 992 |
+
</div>
|
| 993 |
+
</div>
|
| 994 |
+
</div>"""
|
| 995 |
+
yield log_text, card
|
| 996 |
+
|
| 997 |
+
run_btn.click(run_llm_agent_with_score, inputs=[], outputs=[live_output, live_scorecard])
|
| 998 |
|
| 999 |
# ββ COMPARISON TAB ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 1000 |
with gr.Tab("π Baseline vs LLM Agent"):
|
| 1001 |
+
gr.HTML("""
|
| 1002 |
+
<div style="background:linear-gradient(135deg,rgba(15,23,42,0.8),rgba(20,16,48,0.8));
|
| 1003 |
+
border:1px solid rgba(99,102,241,0.2);border-radius:12px;padding:20px 24px;margin-bottom:16px">
|
| 1004 |
+
<div style="font-size:1.1rem;font-weight:700;color:#e2e8f0;margin-bottom:8px">
|
| 1005 |
+
π Head-to-Head: Rule-Based Baseline vs LLM Agent
|
| 1006 |
+
</div>
|
| 1007 |
+
<div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:12px">
|
| 1008 |
+
<div style="background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.08);
|
| 1009 |
+
border-radius:10px;padding:14px">
|
| 1010 |
+
<div style="color:#94a3b8;font-size:0.78rem;font-weight:700;margin-bottom:6px">
|
| 1011 |
+
π§ RULE-BASED BASELINE
|
| 1012 |
+
</div>
|
| 1013 |
+
<div style="color:#64748b;font-size:0.8rem;line-height:1.6">
|
| 1014 |
+
Hardcoded scripts β always applies the same predefined fix sequence.
|
| 1015 |
+
Fast, but brittle. Fails if the environment varies even slightly.
|
| 1016 |
+
</div>
|
| 1017 |
+
</div>
|
| 1018 |
+
<div style="background:rgba(99,102,241,0.05);border:1px solid rgba(99,102,241,0.25);
|
| 1019 |
+
border-radius:10px;padding:14px">
|
| 1020 |
+
<div style="color:#a5b4fc;font-size:0.78rem;font-weight:700;margin-bottom:6px">
|
| 1021 |
+
π€ LLM AGENT (Groq Llama 3.1 8B)
|
| 1022 |
+
</div>
|
| 1023 |
+
<div style="color:#64748b;font-size:0.8rem;line-height:1.6">
|
| 1024 |
+
Reads the error log and current script, reasons about the root cause,
|
| 1025 |
+
then generates targeted fixes β no rules, no hardcoding.
|
| 1026 |
+
</div>
|
| 1027 |
+
</div>
|
| 1028 |
+
</div>
|
| 1029 |
+
<div style="margin-top:10px;color:#475569;font-size:0.77rem">
|
| 1030 |
+
β‘ Each agent runs on its own <strong style="color:#64748b">private isolated environment</strong> β zero shared state between runs.
|
| 1031 |
+
</div>
|
| 1032 |
+
</div>""")
|
| 1033 |
with gr.Row():
|
| 1034 |
with gr.Column():
|
| 1035 |
+
gr.HTML("""<div style="color:#94a3b8;font-weight:700;font-size:0.9rem;padding:4px 0">
|
| 1036 |
+
π§ Rule-Based Baseline</div>""")
|
| 1037 |
run_baseline_cmp_btn = gr.Button("βΆ Run Baseline Agent", elem_classes="btn-reset")
|
| 1038 |
baseline_cmp_log = gr.Textbox(
|
| 1039 |
label="Baseline Log", lines=28, interactive=False,
|
| 1040 |
+
placeholder="Click to run baseline agentβ¦\n\nApplies fixed rule sequences β no reasoning.", elem_classes="code-box"
|
| 1041 |
)
|
| 1042 |
with gr.Column():
|
| 1043 |
+
gr.HTML("""<div style="color:#a5b4fc;font-weight:700;font-size:0.9rem;padding:4px 0">
|
| 1044 |
+
π€ LLM Agent (Groq Llama 3.1 8B)</div>""")
|
| 1045 |
run_llm_cmp_btn = gr.Button("βΆ Run LLM Agent", elem_classes="btn-primary")
|
| 1046 |
llm_cmp_log = gr.Textbox(
|
| 1047 |
label="LLM Log", lines=28, interactive=False,
|
| 1048 |
+
placeholder="Click to run LLM agentβ¦\n\nThe model reads error logs and reasons about each fix.", elem_classes="code-box"
|
| 1049 |
)
|
| 1050 |
+
llm_scorecard = gr.HTML("")
|
| 1051 |
+
|
| 1052 |
+
baseline_scorecard = gr.HTML("")
|
| 1053 |
|
| 1054 |
_ICONS = {"inspect_data":"π","run_script":"βΆοΈ ","edit_script":"βοΈ ","query_actor":"π€","submit":"π€"}
|
| 1055 |
|
|
|
|
| 1390 |
yield emit(f" Episode score : {_env.episode_score:.2f}")
|
| 1391 |
yield emit(f"\n {'β
' if _env.episode_score >= 0.75 else 'β οΈ' if _env.episode_score > 0 else 'β'} LLM Agent complete.")
|
| 1392 |
|
| 1393 |
+
with gr.Row():
|
| 1394 |
+
baseline_scorecard = gr.HTML("")
|
| 1395 |
+
llm_scorecard = gr.HTML("")
|
| 1396 |
+
|
| 1397 |
+
def _make_scorecard(log_text, label, label_color, description):
|
| 1398 |
+
import re as _re
|
| 1399 |
+
score_m = _re.search(r"Episode score\s*:\s*([\d.]+)", log_text)
|
| 1400 |
+
stages_m = _re.search(r"Stages completed\s*:\s*(\[.*?\])", log_text)
|
| 1401 |
+
score = float(score_m.group(1)) if score_m else 0.0
|
| 1402 |
+
stages = stages_m.group(1) if stages_m else "[]"
|
| 1403 |
+
pct = int(score * 100)
|
| 1404 |
+
color = "#22c55e" if pct >= 75 else "#f59e0b" if pct >= 25 else "#ef4444"
|
| 1405 |
+
return f"""<div class="score-display">
|
| 1406 |
+
<div class="score-card">
|
| 1407 |
+
<div class="score-card-big" style="color:{color}">{pct}%</div>
|
| 1408 |
+
<div class="score-card-label">EPISODE SCORE</div>
|
| 1409 |
+
</div>
|
| 1410 |
+
<div class="score-card">
|
| 1411 |
+
<div style="font-size:1.3rem;font-weight:800;color:#94a3b8;line-height:1">{stages}</div>
|
| 1412 |
+
<div class="score-card-label">STAGES COMPLETED</div>
|
| 1413 |
+
</div>
|
| 1414 |
+
<div class="score-card" style="flex:2">
|
| 1415 |
+
<div style="color:#64748b;font-size:0.8rem;line-height:1.7;text-align:left">
|
| 1416 |
+
<strong style="color:{label_color}">{label}</strong><br>{description}
|
| 1417 |
+
</div>
|
| 1418 |
+
</div>
|
| 1419 |
+
</div>"""
|
| 1420 |
+
|
| 1421 |
+
def run_baseline_cmp_with_card():
|
| 1422 |
+
log_text = ""
|
| 1423 |
+
for chunk in run_baseline_cmp():
|
| 1424 |
+
log_text = chunk
|
| 1425 |
+
yield chunk, ""
|
| 1426 |
+
yield log_text, _make_scorecard(
|
| 1427 |
+
log_text, "Rule-Based Baseline", "#94a3b8",
|
| 1428 |
+
"Applies hardcoded fix sequences. Reliable on known bug patterns, but cannot adapt when the environment deviates."
|
| 1429 |
+
)
|
| 1430 |
+
|
| 1431 |
+
def run_llm_cmp_with_card():
|
| 1432 |
+
log_text = ""
|
| 1433 |
+
for chunk in run_llm_cmp():
|
| 1434 |
+
log_text = chunk
|
| 1435 |
+
yield chunk, ""
|
| 1436 |
+
yield log_text, _make_scorecard(
|
| 1437 |
+
log_text, "LLM Agent (Groq Llama 3.1 8B)", "#818cf8",
|
| 1438 |
+
"Reads the error log and current script, reasons about the root cause, and generates fix actions β no hardcoded rules."
|
| 1439 |
+
)
|
| 1440 |
+
|
| 1441 |
+
run_baseline_cmp_btn.click(run_baseline_cmp_with_card, inputs=[], outputs=[baseline_cmp_log, baseline_scorecard])
|
| 1442 |
+
run_llm_cmp_btn.click(run_llm_cmp_with_card, inputs=[], outputs=[llm_cmp_log, llm_scorecard])
|
| 1443 |
|
| 1444 |
|
| 1445 |
# ββ DOCS TAB βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|