Ramit13 commited on
Commit
b985a5f
Β·
verified Β·
1 Parent(s): 9bc4c6b

Redesign UI: styled table, filters, charts tab, hero header

Browse files
Files changed (3) hide show
  1. __pycache__/app.cpython-313.pyc +0 -0
  2. app.py +310 -78
  3. requirements.txt +1 -0
__pycache__/app.cpython-313.pyc ADDED
Binary file (24 kB). View file
 
app.py CHANGED
@@ -8,6 +8,7 @@ from datetime import datetime, timezone
8
 
9
  import gradio as gr
10
  import pandas as pd
 
11
  from huggingface_hub import HfApi, hf_hub_download, snapshot_download
12
 
13
  from scoring import load_predictions_jsonl, score_predictions
@@ -23,15 +24,42 @@ api = HfApi(token=TOKEN)
23
 
24
  TIER_LABELS = {
25
  "tier1_direct": "T1 Direct",
26
- "tier2_parametric": "T2 Parametric",
27
- "tier3_multi_intent": "T3 Multi-intent",
28
  "tier4_implicit": "T4 Implicit",
29
  "tier5_needle": "T5 Needle",
30
- "tier6_correction": "T6 Correction",
31
- "tier7_multiturn": "T7 Multi-turn",
32
- "tier8_intent_blending": "T8 Blending",
33
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
 
 
 
35
 
36
  def _load_gt():
37
  path = hf_hub_download(GT_REPO, "gt.jsonl", repo_type="dataset", token=TOKEN)
@@ -45,11 +73,10 @@ def _load_entries():
45
  entries = []
46
  entries_dir = os.path.join(local, "entries")
47
  if os.path.isdir(entries_dir):
48
- for fname in os.listdir(entries_dir):
49
  if fname.endswith(".json"):
50
  with open(os.path.join(entries_dir, fname)) as f:
51
  entries.append(json.load(f))
52
- # Keep the latest entry per model name
53
  latest = {}
54
  for e in entries:
55
  key = e.get("model", "?")
@@ -58,36 +85,120 @@ def _load_entries():
58
  return list(latest.values())
59
 
60
 
61
- def build_table():
62
  rows = []
63
  for e in _load_entries():
 
 
 
64
  row = {
65
- "Model": e.get("model", "?"),
66
- "Type": e.get("model_type", ""),
 
 
67
  "Tool Acc": e["overall"]["tool_accuracy"],
68
  "Exact Match": e["overall"]["exact_match"],
69
  "Param F1": e["overall"]["param_f1"],
70
  }
71
  for tier, label in TIER_LABELS.items():
72
  t = e.get("tiers", {}).get(tier)
73
- row[label] = t["tool_accuracy"] if t else None
74
- row["Tiers"] = e["overall"].get("n_tiers", len(e.get("tiers", {})))
75
  row["Date"] = e.get("date", "")
76
- row["Submitter"] = e.get("submitter", "")
77
  rows.append(row)
78
  if not rows:
79
- return pd.DataFrame(columns=["Model", "Type", "Tool Acc", "Exact Match", "Param F1"])
80
- df = pd.DataFrame(rows).sort_values("Tool Acc", ascending=False).reset_index(drop=True)
81
- df.insert(0, "Rank", range(1, len(df) + 1))
82
- return df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
 
 
 
84
 
85
- def submit(model_name, model_type, link, submitter, file):
 
 
86
  try:
87
  if not model_name or not model_name.strip():
88
- return "**Error:** please provide a model name.", build_table()
89
  if file is None:
90
- return "**Error:** please upload a predictions JSONL file.", build_table()
91
 
92
  predictions = load_predictions_jsonl(file)
93
  gt_rows = _load_gt()
@@ -118,34 +229,95 @@ def submit(model_name, model_type, link, submitter, file):
118
  )
119
 
120
  o = result["overall"]
 
 
 
 
 
121
  msg = (
122
- f"**Submission scored and added.**\n\n"
123
- f"- Tool Accuracy: **{o['tool_accuracy']:.1%}**\n"
124
- f"- Exact Match: **{o['exact_match']:.1%}**\n"
125
- f"- Param F1: **{o['param_f1']:.1%}**\n"
126
- f"- Samples scored: {result['n_scored']} "
127
- f"(missing predictions: {result['n_missing']}, tiers covered: {o['n_tiers']}/8)"
 
 
 
 
 
128
  )
129
- return msg, build_table()
130
  except ValueError as e:
131
- return f"**Error:** {e}", build_table()
132
  except Exception as e:
133
- return f"**Unexpected error:** {type(e).__name__}: {e}", build_table()
134
 
135
 
136
- ABOUT = f"""
137
- ## Audio2Tool Leaderboard
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
- Benchmarks audio-language models on **voice-command tool calling**: the model
140
- hears an audio command and must emit the right tool call with the right
141
- parameters, across 8 difficulty tiers (direct commands, parametric, multi-intent,
142
- implicit, needle-in-haystack, self-correction, multi-turn, intent blending).
 
 
 
 
 
 
 
 
143
 
144
- - **Eval set:** [{EVAL_REPO}](https://huggingface.co/datasets/{EVAL_REPO}) β€”
145
- 1,579 held-out samples (~200 queries/tier) from the private split of
146
- [{MAIN_DATASET}](https://huggingface.co/datasets/{MAIN_DATASET}).
147
- Ground-truth labels are hidden; scoring happens in this Space.
148
- - **Benchmark code:** [{BENCHMARK_REPO}]({BENCHMARK_REPO})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  ### Metrics
151
 
@@ -155,59 +327,119 @@ implicit, needle-in-haystack, self-correction, multi-turn, intent blending).
155
  | **Exact Match** | Tool name and all parameters match exactly |
156
  | **Param F1** | F1 over parameter key/value pairs (0 if the tool is wrong) |
157
 
158
- Overall scores are macro-averaged across covered tiers. Per-tier columns show
159
- Tool Accuracy. Entries marked *cascaded (oracle ASR)* consume ground-truth
160
- transcripts instead of audio and serve as text-side upper bounds.
161
 
162
  ### How to submit
163
 
164
- 1. Download the eval set: `hf download {EVAL_REPO} --repo-type dataset --local-dir eval`
165
- 2. Run your model on each sample's audio (see `metadata.jsonl`; multi-turn
166
- samples list turn audio in order).
167
- 3. Produce a JSONL file, one row per sample:
168
- `{{"sample_id": "tier1_direct/00042", "prediction": "setZoneTemperature(zone=Driver, temperature=21.0)"}}`
169
- For multi-intent samples put several calls in one string (primary first).
170
- 4. Upload it on the **Submit** tab.
 
 
 
 
 
 
 
 
 
 
 
171
  """
172
 
173
- with gr.Blocks(title="Audio2Tool Leaderboard") as demo:
174
- gr.Markdown("# πŸŽ™οΈπŸ”§ Audio2Tool Leaderboard")
175
- gr.Markdown(
176
- "Voice-command tool calling across 8 difficulty tiers β€” scored on a "
177
- f"held-out private set ([eval audio]({'https://huggingface.co/datasets/' + EVAL_REPO}), "
178
- f"[benchmark code]({BENCHMARK_REPO}))."
179
- )
180
 
181
- with gr.Tab("πŸ† Leaderboard"):
182
- table = gr.Dataframe(value=build_table, datatype="number", wrap=True)
183
- refresh = gr.Button("Refresh")
184
- refresh.click(fn=build_table, outputs=table)
185
 
186
- with gr.Tab("πŸ“€ Submit"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  gr.Markdown(
188
- "Score your model's predictions on the hidden test labels and add it "
189
- "to the leaderboard. See the **About** tab for the prediction format."
 
190
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  with gr.Row():
192
- model_name = gr.Textbox(label="Model name", placeholder="e.g. MyAudioLM-8B")
193
- model_type = gr.Dropdown(
194
- label="Model type",
195
- choices=["end-to-end", "cascaded", "cascaded (oracle ASR)", "other"],
196
- value="end-to-end",
197
- )
198
- with gr.Row():
199
- link = gr.Textbox(label="Link (paper / model card)", placeholder="https://…")
200
- submitter = gr.Textbox(label="Submitted by", placeholder="your name or org")
201
- file = gr.File(label="Predictions (.jsonl)", file_types=[".jsonl", ".json"], type="filepath")
202
- submit_btn = gr.Button("Score and submit", variant="primary")
203
- status = gr.Markdown()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  submit_btn.click(
205
  fn=submit,
206
- inputs=[model_name, model_type, link, submitter, file],
207
  outputs=[status, table],
208
  )
209
 
210
  with gr.Tab("ℹ️ About"):
211
  gr.Markdown(ABOUT)
212
 
213
- demo.launch()
 
 
8
 
9
  import gradio as gr
10
  import pandas as pd
11
+ import plotly.graph_objects as go
12
  from huggingface_hub import HfApi, hf_hub_download, snapshot_download
13
 
14
  from scoring import load_predictions_jsonl, score_predictions
 
24
 
25
  TIER_LABELS = {
26
  "tier1_direct": "T1 Direct",
27
+ "tier2_parametric": "T2 Param",
28
+ "tier3_multi_intent": "T3 Multi",
29
  "tier4_implicit": "T4 Implicit",
30
  "tier5_needle": "T5 Needle",
31
+ "tier6_correction": "T6 Correct",
32
+ "tier7_multiturn": "T7 Turns",
33
+ "tier8_intent_blending": "T8 Blend",
34
  }
35
+ TIER_FULL = {
36
+ "tier1_direct": "Tier 1 β€” Direct commands",
37
+ "tier2_parametric": "Tier 2 β€” Parametric",
38
+ "tier3_multi_intent": "Tier 3 β€” Multi-intent",
39
+ "tier4_implicit": "Tier 4 β€” Implicit intent",
40
+ "tier5_needle": "Tier 5 β€” Needle in haystack",
41
+ "tier6_correction": "Tier 6 β€” Self-correction",
42
+ "tier7_multiturn": "Tier 7 β€” Multi-turn",
43
+ "tier8_intent_blending": "Tier 8 β€” Intent blending",
44
+ }
45
+ METRIC_KEYS = {
46
+ "Tool Accuracy": "tool_accuracy",
47
+ "Exact Match": "exact_match",
48
+ "Param F1": "param_f1",
49
+ }
50
+ TYPE_BADGES = {
51
+ "end-to-end": "πŸŽ™οΈ end-to-end",
52
+ "cascaded": "⛓️ cascaded",
53
+ "cascaded (oracle ASR)": "πŸ“œ oracle ASR",
54
+ "other": "❓ other",
55
+ }
56
+ MODEL_TYPES = list(TYPE_BADGES.keys())
57
+ PCT_COLS = ["Tool Acc", "Exact Match", "Param F1"] + list(TIER_LABELS.values())
58
+
59
 
60
+ # --------------------------------------------------------------------------
61
+ # Data loading
62
+ # --------------------------------------------------------------------------
63
 
64
  def _load_gt():
65
  path = hf_hub_download(GT_REPO, "gt.jsonl", repo_type="dataset", token=TOKEN)
 
73
  entries = []
74
  entries_dir = os.path.join(local, "entries")
75
  if os.path.isdir(entries_dir):
76
+ for fname in sorted(os.listdir(entries_dir)):
77
  if fname.endswith(".json"):
78
  with open(os.path.join(entries_dir, fname)) as f:
79
  entries.append(json.load(f))
 
80
  latest = {}
81
  for e in entries:
82
  key = e.get("model", "?")
 
85
  return list(latest.values())
86
 
87
 
88
+ def build_df(tier_metric_key: str = "tool_accuracy") -> pd.DataFrame:
89
  rows = []
90
  for e in _load_entries():
91
+ name = e.get("model", "?")
92
+ link = (e.get("link") or "").strip()
93
+ model_md = f"**[{name}]({link})**" if link.startswith("http") else f"**{name}**"
94
  row = {
95
+ "Model": model_md,
96
+ "_model_raw": name,
97
+ "Type": TYPE_BADGES.get(e.get("model_type", "other"), e.get("model_type", "")),
98
+ "_type_raw": e.get("model_type", "other"),
99
  "Tool Acc": e["overall"]["tool_accuracy"],
100
  "Exact Match": e["overall"]["exact_match"],
101
  "Param F1": e["overall"]["param_f1"],
102
  }
103
  for tier, label in TIER_LABELS.items():
104
  t = e.get("tiers", {}).get(tier)
105
+ row[label] = t[tier_metric_key] if t else None
106
+ row["Tiers"] = f"{e['overall'].get('n_tiers', len(e.get('tiers', {})))}/8"
107
  row["Date"] = e.get("date", "")
 
108
  rows.append(row)
109
  if not rows:
110
+ return pd.DataFrame()
111
+ return pd.DataFrame(rows)
112
+
113
+
114
+ # --------------------------------------------------------------------------
115
+ # Styling
116
+ # --------------------------------------------------------------------------
117
+
118
+ def _cell_style(v):
119
+ """Green intensity scaled by score; readable in light and dark mode."""
120
+ if v is None or (isinstance(v, float) and pd.isna(v)):
121
+ return "color: #9ca3af"
122
+ alpha = 0.06 + 0.42 * float(v)
123
+ return f"background-color: rgba(16, 163, 90, {alpha:.2f}); font-variant-numeric: tabular-nums"
124
+
125
+
126
+ def style_table(df: pd.DataFrame, sort_metric: str = "Tool Acc"):
127
+ if df.empty:
128
+ return pd.DataFrame({"": ["No entries yet β€” be the first to submit!"]})
129
+ df = df.sort_values(sort_metric, ascending=False).reset_index(drop=True)
130
+ medals = ["πŸ₯‡", "πŸ₯ˆ", "πŸ₯‰"] + [str(i) for i in range(4, len(df) + 1)]
131
+ df.insert(0, "Rank", medals[: len(df)])
132
+ df = df.drop(columns=["_model_raw", "_type_raw"])
133
+
134
+ pct_cols = [c for c in PCT_COLS if c in df.columns]
135
+ styler = (
136
+ df.style
137
+ .format({c: lambda v: "–" if pd.isna(v) else f"{v * 100:.1f}" for c in pct_cols})
138
+ .map(_cell_style, subset=pct_cols)
139
+ .set_properties(subset=["Rank"], **{"text-align": "center", "font-size": "1.05em"})
140
+ )
141
+ return styler
142
+
143
+
144
+ def leaderboard_view(search: str, types: list, tier_metric: str, sort_metric: str):
145
+ df = build_df(METRIC_KEYS[tier_metric])
146
+ if df.empty:
147
+ return style_table(df)
148
+ if types:
149
+ df = df[df["_type_raw"].isin(types)]
150
+ if search and search.strip():
151
+ df = df[df["_model_raw"].str.contains(search.strip(), case=False, regex=False)]
152
+ return style_table(df, sort_metric)
153
+
154
+
155
+ # --------------------------------------------------------------------------
156
+ # Charts
157
+ # --------------------------------------------------------------------------
158
+
159
+ PALETTE = ["#2563eb", "#059669", "#d97706", "#dc2626", "#7c3aed",
160
+ "#0891b2", "#be185d", "#4d7c0f", "#b45309", "#6d28d9"]
161
+
162
+
163
+ def build_chart(metric_label: str):
164
+ key = METRIC_KEYS[metric_label]
165
+ entries = sorted(_load_entries(),
166
+ key=lambda e: e["overall"][key], reverse=True)
167
+ fig = go.Figure()
168
+ tiers = list(TIER_LABELS.keys())
169
+ for i, e in enumerate(entries[:10]):
170
+ ys = [e.get("tiers", {}).get(t, {}).get(key) for t in tiers]
171
+ fig.add_trace(go.Bar(
172
+ name=e.get("model", "?"),
173
+ x=[TIER_LABELS[t] for t in tiers],
174
+ y=[None if y is None else y * 100 for y in ys],
175
+ marker_color=PALETTE[i % len(PALETTE)],
176
+ ))
177
+ fig.update_layout(
178
+ barmode="group",
179
+ template="plotly_white",
180
+ yaxis_title=f"{metric_label} (%)",
181
+ yaxis_range=[0, 100],
182
+ legend=dict(orientation="h", yanchor="bottom", y=1.02, x=0),
183
+ margin=dict(l=40, r=20, t=30, b=40),
184
+ height=480,
185
+ font=dict(family="ui-sans-serif, system-ui, sans-serif"),
186
+ )
187
+ return fig
188
+
189
 
190
+ # --------------------------------------------------------------------------
191
+ # Submission
192
+ # --------------------------------------------------------------------------
193
 
194
+ def submit(model_name, model_type, link, submitter, file,
195
+ search, types, tier_metric, sort_metric):
196
+ table = lambda: leaderboard_view(search, types, tier_metric, sort_metric)
197
  try:
198
  if not model_name or not model_name.strip():
199
+ return "⚠️ **Please provide a model name.**", table()
200
  if file is None:
201
+ return "⚠️ **Please upload a predictions `.jsonl` file.**", table()
202
 
203
  predictions = load_predictions_jsonl(file)
204
  gt_rows = _load_gt()
 
229
  )
230
 
231
  o = result["overall"]
232
+ per_tier = "\n".join(
233
+ f"| {TIER_FULL[t]} | {m['tool_accuracy']:.1%} | {m['exact_match']:.1%} "
234
+ f"| {m['param_f1']:.1%} | {m['n']} |"
235
+ for t, m in result["tiers"].items()
236
+ )
237
  msg = (
238
+ f"### βœ… Submission scored and added\n\n"
239
+ f"| Overall | Score |\n|---|---|\n"
240
+ f"| Tool Accuracy | **{o['tool_accuracy']:.1%}** |\n"
241
+ f"| Exact Match | **{o['exact_match']:.1%}** |\n"
242
+ f"| Param F1 | **{o['param_f1']:.1%}** |\n\n"
243
+ f"Scored **{result['n_scored']}** samples across "
244
+ f"**{o['n_tiers']}/8** tiers"
245
+ + (f" · ⚠️ {result['n_missing']} samples had no prediction"
246
+ if result["n_missing"] else "")
247
+ + "\n\n<details><summary>Per-tier breakdown</summary>\n\n"
248
+ f"| Tier | Tool Acc | Exact | F1 | n |\n|---|---|---|---|---|\n{per_tier}\n\n</details>"
249
  )
250
+ return msg, table()
251
  except ValueError as e:
252
+ return f"❌ **Error:** {e}", table()
253
  except Exception as e:
254
+ return f"❌ **Unexpected error:** {type(e).__name__}: {e}", table()
255
 
256
 
257
+ # --------------------------------------------------------------------------
258
+ # Layout
259
+ # --------------------------------------------------------------------------
260
+
261
+ CSS = """
262
+ .a2t-hero {
263
+ text-align: center;
264
+ padding: 28px 16px 20px;
265
+ border-radius: 14px;
266
+ background: linear-gradient(135deg, #0f2d5c 0%, #14532d 100%);
267
+ color: #f8fafc;
268
+ margin-bottom: 4px;
269
+ }
270
+ .a2t-hero h1 { font-size: 2.1em; margin: 0 0 6px; color: #ffffff; }
271
+ .a2t-hero p { margin: 4px 0; color: #cbd5e1; font-size: 1.02em; }
272
+ .a2t-hero a { color: #7dd3fc; text-decoration: none; font-weight: 600; }
273
+ .a2t-hero a:hover { text-decoration: underline; }
274
+ .a2t-badges { margin-top: 10px; }
275
+ .a2t-badges span {
276
+ display: inline-block; padding: 4px 12px; margin: 2px 4px;
277
+ border-radius: 999px; background: rgba(255,255,255,.12);
278
+ font-size: .86em; color: #e2e8f0;
279
+ }
280
+ #leaderboard-table table { font-size: .93em; }
281
+ #leaderboard-table th { white-space: nowrap; }
282
+ #leaderboard-table td:nth-child(2) { white-space: nowrap; }
283
+ .a2t-note { color: #6b7280; font-size: .86em; margin-top: 2px; }
284
+ """
285
 
286
+ HERO = f"""
287
+ <div class="a2t-hero">
288
+ <h1>πŸŽ™οΈπŸ”§ Audio2Tool Leaderboard</h1>
289
+ <p>Voice-command tool calling across 8 difficulty tiers, scored on a held-out private set.</p>
290
+ <div class="a2t-badges">
291
+ <span>πŸ—‚οΈ <a href="https://huggingface.co/datasets/{EVAL_REPO}" target="_blank">Eval set</a></span>
292
+ <span>πŸ“¦ <a href="https://huggingface.co/datasets/{MAIN_DATASET}" target="_blank">Dataset</a></span>
293
+ <span>πŸ’» <a href="{BENCHMARK_REPO}" target="_blank">Benchmark code</a></span>
294
+ <span>πŸ“ˆ <a href="https://huggingface.co/datasets/{RESULTS_REPO}" target="_blank">Raw results</a></span>
295
+ </div>
296
+ </div>
297
+ """
298
 
299
+ ABOUT = f"""
300
+ ## What is this?
301
+
302
+ Audio2Tool benchmarks audio-language models on **voice-command tool calling**:
303
+ the model hears a spoken command and must emit the right tool call with the
304
+ right parameters. The eval set is a held-out subset of the private split of
305
+ [{MAIN_DATASET}](https://huggingface.co/datasets/{MAIN_DATASET})
306
+ (up to 200 queries per tier, 1,579 samples). Labels are hidden β€” scoring
307
+ happens inside this Space.
308
+
309
+ ### The 8 tiers
310
+
311
+ | Tier | Challenge |
312
+ |------|-----------|
313
+ | **T1 Direct** | Straightforward commands ("Lock the car") |
314
+ | **T2 Param** | Commands with parameter values ("Set driver temp to 21") |
315
+ | **T3 Multi** | Several intents in one utterance |
316
+ | **T4 Implicit** | Intent must be inferred ("It's freezing back here") |
317
+ | **T5 Needle** | Command buried in long distracting audio |
318
+ | **T6 Correct** | Speaker self-corrects mid-utterance |
319
+ | **T7 Turns** | Multi-turn conversations (turn audio provided in order) |
320
+ | **T8 Blend** | Overlapping speakers / blended intents |
321
 
322
  ### Metrics
323
 
 
327
  | **Exact Match** | Tool name and all parameters match exactly |
328
  | **Param F1** | F1 over parameter key/value pairs (0 if the tool is wrong) |
329
 
330
+ Overall scores are macro-averaged across covered tiers. Entries marked
331
+ *oracle ASR* consume ground-truth transcripts instead of audio β€” text-side
332
+ upper bounds, not audio models.
333
 
334
  ### How to submit
335
 
336
+ 1. Download the eval set:
337
+ ```
338
+ hf download {EVAL_REPO} --repo-type dataset --local-dir eval
339
+ ```
340
+ 2. For each row of `metadata.jsonl`, run your model on the audio and produce a
341
+ tool-call string. Tools are defined in the dataset's
342
+ [`tools_registry.csv`](https://huggingface.co/datasets/{MAIN_DATASET}/blob/main/tools_registry.csv).
343
+ 3. Write one JSON row per sample:
344
+ ```json
345
+ {{"sample_id": "tier1_direct/00042", "prediction": "setZoneTemperature(zone=Driver, temperature=21.0)"}}
346
+ ```
347
+ Multi-intent samples: several calls in one string, primary first β€”
348
+ `setLockState(state=Locked) setFanSpeed(level=7)`
349
+ 4. Upload the file on the **Submit** tab. Scores appear immediately.
350
+
351
+ The scorer uses the exact normalization of the
352
+ [benchmark code]({BENCHMARK_REPO}), so leaderboard numbers are comparable
353
+ to local runs.
354
  """
355
 
356
+ theme = gr.themes.Soft(
357
+ primary_hue="emerald",
358
+ neutral_hue="slate",
359
+ font=[gr.themes.GoogleFont("Inter"), "ui-sans-serif", "system-ui"],
360
+ )
 
 
361
 
362
+ with gr.Blocks(title="Audio2Tool Leaderboard", theme=theme, css=CSS) as demo:
363
+ gr.HTML(HERO)
 
 
364
 
365
+ with gr.Tab("πŸ† Leaderboard"):
366
+ with gr.Row():
367
+ search = gr.Textbox(
368
+ label="πŸ” Search models", placeholder="filter by name…", scale=2)
369
+ type_filter = gr.CheckboxGroup(
370
+ choices=MODEL_TYPES, value=MODEL_TYPES, label="Model type", scale=3)
371
+ tier_metric = gr.Dropdown(
372
+ choices=list(METRIC_KEYS), value="Tool Accuracy",
373
+ label="Per-tier metric", scale=1)
374
+ sort_metric = gr.Dropdown(
375
+ choices=["Tool Acc", "Exact Match", "Param F1"], value="Tool Acc",
376
+ label="Sort by", scale=1)
377
+ table = gr.Dataframe(
378
+ value=lambda: leaderboard_view("", MODEL_TYPES, "Tool Accuracy", "Tool Acc"),
379
+ datatype="markdown", wrap=False, elem_id="leaderboard-table",
380
+ interactive=False,
381
+ )
382
  gr.Markdown(
383
+ "<p class='a2t-note'>All numbers are percentages. Per-tier columns show the metric "
384
+ "selected above; overall columns are macro-averages over covered tiers. "
385
+ "β€œβ€“β€ means the model has no valid result for that tier.</p>"
386
  )
387
+ refresh = gr.Button("πŸ”„ Refresh", size="sm")
388
+
389
+ controls = [search, type_filter, tier_metric, sort_metric]
390
+ for c in controls:
391
+ c.change(fn=leaderboard_view, inputs=controls, outputs=table)
392
+ refresh.click(fn=leaderboard_view, inputs=controls, outputs=table)
393
+
394
+ with gr.Tab("πŸ“Š Charts"):
395
+ chart_metric = gr.Dropdown(
396
+ choices=list(METRIC_KEYS), value="Tool Accuracy", label="Metric")
397
+ chart = gr.Plot(value=lambda: build_chart("Tool Accuracy"))
398
+ chart_metric.change(fn=build_chart, inputs=chart_metric, outputs=chart)
399
+ gr.Markdown(
400
+ "<p class='a2t-note'>Per-tier scores for the top 10 models (by overall score).</p>"
401
+ )
402
+
403
+ with gr.Tab("πŸ“€ Submit"):
404
  with gr.Row():
405
+ with gr.Column(scale=3):
406
+ gr.Markdown("### Add your model\nScore your predictions against the "
407
+ "hidden labels and join the leaderboard.")
408
+ with gr.Row():
409
+ model_name = gr.Textbox(label="Model name *",
410
+ placeholder="e.g. MyAudioLM-8B")
411
+ model_type = gr.Dropdown(label="Model type",
412
+ choices=MODEL_TYPES, value="end-to-end")
413
+ with gr.Row():
414
+ link = gr.Textbox(label="Link (model card / paper)",
415
+ placeholder="https://…")
416
+ submitter = gr.Textbox(label="Submitted by",
417
+ placeholder="your name or org")
418
+ file = gr.File(label="Predictions (.jsonl)",
419
+ file_types=[".jsonl", ".json"], type="filepath")
420
+ submit_btn = gr.Button("πŸš€ Score and submit", variant="primary")
421
+ status = gr.Markdown()
422
+ with gr.Column(scale=2):
423
+ gr.Markdown(
424
+ "### Format\n"
425
+ "One JSON row per sample:\n"
426
+ "```json\n"
427
+ '{"sample_id": "tier1_direct/00042",\n'
428
+ ' "prediction": "setZoneTemperature(zone=Driver, temperature=21.0)"}\n'
429
+ "```\n"
430
+ "- `sample_id` comes from the eval set's `metadata.jsonl`\n"
431
+ "- Multi-intent: several calls in one string, primary first\n"
432
+ "- Partial submissions are scored on covered tiers only\n\n"
433
+ "See the **About** tab for the full walkthrough."
434
+ )
435
  submit_btn.click(
436
  fn=submit,
437
+ inputs=[model_name, model_type, link, submitter, file] + controls,
438
  outputs=[status, table],
439
  )
440
 
441
  with gr.Tab("ℹ️ About"):
442
  gr.Markdown(ABOUT)
443
 
444
+ if __name__ == "__main__":
445
+ demo.launch()
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  gradio>=5.0
2
  huggingface_hub>=0.26
3
  pandas>=2.0
 
 
1
  gradio>=5.0
2
  huggingface_hub>=0.26
3
  pandas>=2.0
4
+ plotly>=5.20