Merge branch 'per_task_results' into pr/26
Browse files- app.py +145 -61
- theme.json +1 -0
app.py
CHANGED
@@ -26,23 +26,28 @@ def make_default_md(arena_df, elo_results):
|
|
26 |
| [Vote](https://chat.lmsys.org) | [Blog](https://lmsys.org/blog/2023-05-03-arena/) | [GitHub](https://github.com/lm-sys/FastChat) | [Paper](https://arxiv.org/abs/2306.05685) | [Dataset](https://github.com/lm-sys/FastChat/blob/main/docs/dataset_release.md) | [Twitter](https://twitter.com/lmsysorg) | [Discord](https://discord.gg/HSWAKCrnFx) |
|
27 |
|
28 |
LMSYS [Chatbot Arena](https://lmsys.org/blog/2023-05-03-arena/) is a crowdsourced open platform for LLM evals.
|
29 |
-
We've collected over **500,000** human preference votes to rank LLMs with the Elo ranking system.
|
30 |
"""
|
31 |
return leaderboard_md
|
32 |
|
33 |
|
34 |
-
def make_arena_leaderboard_md(arena_df):
|
35 |
total_votes = sum(arena_df["num_battles"]) // 2
|
36 |
total_models = len(arena_df)
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
leaderboard_md = f"""
|
39 |
-
Total #models: **{total_models}**. Total #votes: **{total_votes}**. Last updated: March 29, 2024.
|
40 |
|
41 |
-
|
42 |
"""
|
43 |
return leaderboard_md
|
44 |
|
45 |
-
|
46 |
def make_full_leaderboard_md(elo_results):
|
47 |
leaderboard_md = f"""
|
48 |
Three benchmarks are displayed: **Arena Elo**, **MT-Bench** and **MMLU**.
|
@@ -202,51 +207,82 @@ def get_full_table(arena_df, model_table_df):
|
|
202 |
values.sort(key=lambda x: -x[1] if not np.isnan(x[1]) else 1e9)
|
203 |
return values
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
arena_df = arena_df.sort_values(by=["rating"], ascending=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
values = []
|
210 |
for i in range(len(arena_df)):
|
211 |
row = []
|
212 |
model_key = arena_df.index[i]
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
|
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
|
|
|
|
248 |
return values
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=False):
|
251 |
if elo_results_file is None: # Do live update
|
252 |
default_md = "Loading ..."
|
@@ -255,6 +291,9 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=Fa
|
|
255 |
with open(elo_results_file, "rb") as fin:
|
256 |
elo_results = pickle.load(fin)
|
257 |
if "full" in elo_results:
|
|
|
|
|
|
|
258 |
elo_results = elo_results["full"]
|
259 |
|
260 |
p1 = elo_results["win_fraction_heatmap"]
|
@@ -262,9 +301,13 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=Fa
|
|
262 |
p3 = elo_results["bootstrap_elo_rating"]
|
263 |
p4 = elo_results["average_win_rate_bar"]
|
264 |
arena_df = elo_results["leaderboard_table_df"]
|
|
|
|
|
|
|
265 |
default_md = make_default_md(arena_df, elo_results)
|
266 |
|
267 |
md_1 = gr.Markdown(default_md, elem_id="leaderboard_markdown")
|
|
|
268 |
if leaderboard_table_file:
|
269 |
data = load_leaderboard_table_csv(leaderboard_table_file)
|
270 |
model_table_df = pd.DataFrame(data)
|
@@ -274,8 +317,21 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=Fa
|
|
274 |
arena_table_vals = get_arena_table(arena_df, model_table_df)
|
275 |
with gr.Tab("Arena Elo", id=0):
|
276 |
md = make_arena_leaderboard_md(arena_df)
|
277 |
-
gr.Markdown(md, elem_id="leaderboard_markdown")
|
278 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
headers=[
|
280 |
"Rank",
|
281 |
"π€ Model",
|
@@ -299,9 +355,10 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=Fa
|
|
299 |
value=arena_table_vals,
|
300 |
elem_id="arena_leaderboard_dataframe",
|
301 |
height=700,
|
302 |
-
column_widths=[
|
303 |
wrap=True,
|
304 |
)
|
|
|
305 |
with gr.Tab("Full Leaderboard", id=1):
|
306 |
md = make_full_leaderboard_md(elo_results)
|
307 |
gr.Markdown(md, elem_id="leaderboard_markdown")
|
@@ -335,7 +392,7 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=Fa
|
|
335 |
gr.Markdown(
|
336 |
f"""Note: we take the 95% confidence interval into account when determining a model's ranking.
|
337 |
A model is ranked higher only if its lower bound of model score is higher than the upper bound of the other model's score.
|
338 |
-
See Figure 3 below for visualization of the confidence intervals.
|
339 |
""",
|
340 |
elem_id="leaderboard_markdown"
|
341 |
)
|
@@ -343,35 +400,38 @@ See Figure 3 below for visualization of the confidence intervals.
|
|
343 |
leader_component_values[:] = [default_md, p1, p2, p3, p4]
|
344 |
|
345 |
if show_plot:
|
346 |
-
gr.Markdown(
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
elem_id="leaderboard_markdown"
|
352 |
-
)
|
353 |
with gr.Row():
|
354 |
with gr.Column():
|
355 |
gr.Markdown(
|
356 |
-
"#### Figure 1: Fraction of Model A Wins for All Non-tied A vs. B Battles"
|
357 |
)
|
358 |
-
plot_1 = gr.Plot(p1, show_label=False)
|
359 |
with gr.Column():
|
360 |
gr.Markdown(
|
361 |
-
"#### Figure 2: Battle Count for Each Combination of Models (without Ties)"
|
362 |
)
|
363 |
plot_2 = gr.Plot(p2, show_label=False)
|
364 |
with gr.Row():
|
365 |
with gr.Column():
|
366 |
gr.Markdown(
|
367 |
-
"#### Figure 3: Confidence Intervals on Model Strength (via Bootstrapping)"
|
368 |
)
|
369 |
plot_3 = gr.Plot(p3, show_label=False)
|
370 |
with gr.Column():
|
371 |
gr.Markdown(
|
372 |
-
"#### Figure 4: Average Win Rate Against All Other Models (Assuming Uniform Sampling and No Ties)"
|
373 |
)
|
374 |
plot_4 = gr.Plot(p4, show_label=False)
|
|
|
|
|
|
|
|
|
|
|
375 |
|
376 |
gr.Markdown(acknowledgment_md)
|
377 |
|
@@ -379,6 +439,7 @@ You can find more discussions in this blog [post](https://lmsys.org/blog/2023-12
|
|
379 |
return [md_1, plot_1, plot_2, plot_3, plot_4]
|
380 |
return [md_1]
|
381 |
|
|
|
382 |
block_css = """
|
383 |
#notice_markdown {
|
384 |
font-size: 104%
|
@@ -397,9 +458,30 @@ block_css = """
|
|
397 |
padding-top: 6px;
|
398 |
padding-bottom: 6px;
|
399 |
}
|
|
|
400 |
#leaderboard_dataframe td {
|
401 |
line-height: 0.1em;
|
402 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
footer {
|
404 |
display:none !important
|
405 |
}
|
@@ -429,10 +511,12 @@ We thank [Kaggle](https://www.kaggle.com/), [MBZUAI](https://mbzuai.ac.ae/), [a1
|
|
429 |
|
430 |
def build_demo(elo_results_file, leaderboard_table_file):
|
431 |
text_size = gr.themes.sizes.text_lg
|
432 |
-
|
|
|
433 |
with gr.Blocks(
|
434 |
title="Chatbot Arena Leaderboard",
|
435 |
-
theme=
|
|
|
436 |
css=block_css,
|
437 |
) as demo:
|
438 |
leader_components = build_leaderboard_tab(
|
|
|
26 |
| [Vote](https://chat.lmsys.org) | [Blog](https://lmsys.org/blog/2023-05-03-arena/) | [GitHub](https://github.com/lm-sys/FastChat) | [Paper](https://arxiv.org/abs/2306.05685) | [Dataset](https://github.com/lm-sys/FastChat/blob/main/docs/dataset_release.md) | [Twitter](https://twitter.com/lmsysorg) | [Discord](https://discord.gg/HSWAKCrnFx) |
|
27 |
|
28 |
LMSYS [Chatbot Arena](https://lmsys.org/blog/2023-05-03-arena/) is a crowdsourced open platform for LLM evals.
|
29 |
+
We've collected over **500,000** human preference votes to rank LLMs with the Elo ranking system. Contribute your vote π³οΈ at [chat.lmsys.org](https://chat.lmsys.org)!
|
30 |
"""
|
31 |
return leaderboard_md
|
32 |
|
33 |
|
34 |
+
def make_arena_leaderboard_md(arena_df, arena_subset_df=None, name="Overall"):
|
35 |
total_votes = sum(arena_df["num_battles"]) // 2
|
36 |
total_models = len(arena_df)
|
37 |
+
space = " "
|
38 |
+
if arena_subset_df is not None:
|
39 |
+
total_subset_votes = sum(arena_subset_df["num_battles"]) // 2
|
40 |
+
total_subset_models = len(arena_subset_df)
|
41 |
+
vote_str = f"{space} {name} #models: **{total_subset_models}**.{space} {name} #votes: **{'{:,}'.format(total_subset_votes)}**."
|
42 |
+
else:
|
43 |
+
vote_str = ""
|
44 |
leaderboard_md = f"""
|
45 |
+
Total #models: **{total_models}**.{space} Total #votes: **{"{:,}".format(total_votes)}**.{vote_str}{space} Last updated: March 29, 2024.
|
46 |
|
47 |
+
**NEW!** Click the buttons below to view the ELO leaderboard and stats for different input categories. You are currently viewing **{name}** inputs.
|
48 |
"""
|
49 |
return leaderboard_md
|
50 |
|
|
|
51 |
def make_full_leaderboard_md(elo_results):
|
52 |
leaderboard_md = f"""
|
53 |
Three benchmarks are displayed: **Arena Elo**, **MT-Bench** and **MMLU**.
|
|
|
207 |
values.sort(key=lambda x: -x[1] if not np.isnan(x[1]) else 1e9)
|
208 |
return values
|
209 |
|
210 |
+
def create_ranking_str(ranking, ranking_difference):
|
211 |
+
if ranking_difference > 0:
|
212 |
+
return f"{int(ranking)} (\u2191{int(ranking_difference)})"
|
213 |
+
elif ranking_difference < 0:
|
214 |
+
return f"{int(ranking)} (\u2193{int(-ranking_difference)})"
|
215 |
+
else:
|
216 |
+
return f"{int(ranking)}"
|
217 |
+
|
218 |
+
def get_arena_table(arena_df, model_table_df, arena_subset_df=None):
|
219 |
arena_df = arena_df.sort_values(by=["rating"], ascending=False)
|
220 |
+
arena_df = arena_df.sort_values(by=["final_ranking"], ascending=True)
|
221 |
+
# sort by rating
|
222 |
+
if arena_subset_df is not None:
|
223 |
+
arena_subset_df = arena_subset_df.sort_values(by=["rating"], ascending=False)
|
224 |
+
arena_subset_df = arena_subset_df.sort_values(by=["final_ranking"], ascending=True)
|
225 |
+
# join arena_df and arena_subset_df on index
|
226 |
+
arena_df = arena_subset_df.join(arena_df["final_ranking"], rsuffix="_global", how="inner")
|
227 |
+
arena_df['ranking_difference'] = arena_df['final_ranking_global'] - arena_df['final_ranking']
|
228 |
+
arena_df["final_ranking"] = arena_df.apply(lambda x: create_ranking_str(x["final_ranking"], x["ranking_difference"]), axis=1)
|
229 |
+
|
230 |
values = []
|
231 |
for i in range(len(arena_df)):
|
232 |
row = []
|
233 |
model_key = arena_df.index[i]
|
234 |
+
try:
|
235 |
+
model_name = model_table_df[model_table_df["key"] == model_key]["Model"].values[
|
236 |
+
0
|
237 |
+
]
|
238 |
+
|
239 |
+
# rank
|
240 |
+
ranking = arena_df.iloc[i].get("final_ranking") or i+1
|
241 |
+
row.append(ranking)
|
242 |
+
# model display name
|
243 |
+
row.append(model_name)
|
244 |
+
# elo rating
|
245 |
+
row.append(round(arena_df.iloc[i]["rating"]))
|
246 |
+
upper_diff = round(
|
247 |
+
arena_df.iloc[i]["rating_q975"] - arena_df.iloc[i]["rating"]
|
248 |
+
)
|
249 |
+
lower_diff = round(
|
250 |
+
arena_df.iloc[i]["rating"] - arena_df.iloc[i]["rating_q025"]
|
251 |
+
)
|
252 |
+
row.append(f"+{upper_diff}/-{lower_diff}")
|
253 |
+
# num battles
|
254 |
+
row.append(round(arena_df.iloc[i]["num_battles"]))
|
255 |
+
# Organization
|
256 |
+
row.append(
|
257 |
+
model_table_df[model_table_df["key"] == model_key]["Organization"].values[0]
|
258 |
+
)
|
259 |
+
# license
|
260 |
+
row.append(
|
261 |
+
model_table_df[model_table_df["key"] == model_key]["License"].values[0]
|
262 |
+
)
|
263 |
|
264 |
+
cutoff_date = model_table_df[model_table_df["key"] == model_key]["Knowledge cutoff date"].values[0]
|
265 |
+
if cutoff_date == "-":
|
266 |
+
row.append("Unknown")
|
267 |
+
else:
|
268 |
+
row.append(cutoff_date)
|
269 |
+
values.append(row)
|
270 |
+
except Exception as e:
|
271 |
+
print(f"{model_key} - {e}")
|
272 |
return values
|
273 |
|
274 |
+
def update_leaderboard_and_plots(button, arena_df, model_table_df, arena_subset_df, elo_subset_results):
|
275 |
+
arena_values = get_arena_table(arena_df, model_table_df, arena_subset_df)
|
276 |
+
p1 = elo_subset_results["win_fraction_heatmap"]
|
277 |
+
p2 = elo_subset_results["battle_count_heatmap"]
|
278 |
+
p3 = elo_subset_results["bootstrap_elo_rating"]
|
279 |
+
p4 = elo_subset_results["average_win_rate_bar"]
|
280 |
+
more_stats_md = f"""## More Statistics for Chatbot Arena ({button})
|
281 |
+
"""
|
282 |
+
leaderboard_md = make_arena_leaderboard_md(arena_df, arena_subset_df, name=button)
|
283 |
+
return arena_values, p1, p2, p3, p4, more_stats_md, leaderboard_md
|
284 |
+
|
285 |
+
|
286 |
def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=False):
|
287 |
if elo_results_file is None: # Do live update
|
288 |
default_md = "Loading ..."
|
|
|
291 |
with open(elo_results_file, "rb") as fin:
|
292 |
elo_results = pickle.load(fin)
|
293 |
if "full" in elo_results:
|
294 |
+
elo_chinese_results = elo_results["chinese"]
|
295 |
+
elo_long_results = elo_results["long"]
|
296 |
+
elo_english_results = elo_results["english"]
|
297 |
elo_results = elo_results["full"]
|
298 |
|
299 |
p1 = elo_results["win_fraction_heatmap"]
|
|
|
301 |
p3 = elo_results["bootstrap_elo_rating"]
|
302 |
p4 = elo_results["average_win_rate_bar"]
|
303 |
arena_df = elo_results["leaderboard_table_df"]
|
304 |
+
arena_chinese_df = elo_chinese_results["leaderboard_table_df"]
|
305 |
+
arena_long_df = elo_long_results["leaderboard_table_df"]
|
306 |
+
arena_english_df = elo_english_results["leaderboard_table_df"]
|
307 |
default_md = make_default_md(arena_df, elo_results)
|
308 |
|
309 |
md_1 = gr.Markdown(default_md, elem_id="leaderboard_markdown")
|
310 |
+
# md = make_arena_leaderboard_md(arena_df, arena_chinese_df, arena_long_df, arena_english_df)
|
311 |
if leaderboard_table_file:
|
312 |
data = load_leaderboard_table_csv(leaderboard_table_file)
|
313 |
model_table_df = pd.DataFrame(data)
|
|
|
317 |
arena_table_vals = get_arena_table(arena_df, model_table_df)
|
318 |
with gr.Tab("Arena Elo", id=0):
|
319 |
md = make_arena_leaderboard_md(arena_df)
|
320 |
+
leaderboard_markdown = gr.Markdown(md, elem_id="leaderboard_markdown")
|
321 |
+
with gr.Row():
|
322 |
+
overall_rating = gr.Button("Overall")
|
323 |
+
# update_overall_rating_df = lambda _: get_arena_table(arena_df, model_table_df)
|
324 |
+
update_overall_rating_df = lambda x: update_leaderboard_and_plots(x, arena_df, model_table_df, None, elo_results)
|
325 |
+
english_rating = gr.Button("English")
|
326 |
+
update_english_rating_df = lambda x: update_leaderboard_and_plots(x, arena_df, model_table_df, arena_english_df, elo_english_results)
|
327 |
+
# update_english_rating_df = lambda _: get_arena_table(arena_df, model_table_df, arena_english_df)
|
328 |
+
chinese_rating = gr.Button("Chinese")
|
329 |
+
update_chinese_rating_df = lambda x: update_leaderboard_and_plots(x, arena_df, model_table_df, arena_chinese_df, elo_chinese_results)
|
330 |
+
# update_chinese_rating_df = lambda _: get_arena_table(arena_df, model_table_df, arena_chinese_df)
|
331 |
+
long_context_rating = gr.Button("Long Context")
|
332 |
+
update_long_context_rating_df = lambda x: update_leaderboard_and_plots(x, arena_df, model_table_df, arena_long_df, elo_long_results)
|
333 |
+
# update_long_context_rating_df = lambda _: get_arena_table(arena_df, model_table_df, arena_long_df)
|
334 |
+
elo_display_df = gr.Dataframe(
|
335 |
headers=[
|
336 |
"Rank",
|
337 |
"π€ Model",
|
|
|
355 |
value=arena_table_vals,
|
356 |
elem_id="arena_leaderboard_dataframe",
|
357 |
height=700,
|
358 |
+
column_widths=[70, 190, 110, 100, 90, 160, 150, 140],
|
359 |
wrap=True,
|
360 |
)
|
361 |
+
|
362 |
with gr.Tab("Full Leaderboard", id=1):
|
363 |
md = make_full_leaderboard_md(elo_results)
|
364 |
gr.Markdown(md, elem_id="leaderboard_markdown")
|
|
|
392 |
gr.Markdown(
|
393 |
f"""Note: we take the 95% confidence interval into account when determining a model's ranking.
|
394 |
A model is ranked higher only if its lower bound of model score is higher than the upper bound of the other model's score.
|
395 |
+
See Figure 3 below for visualization of the confidence intervals. Code to recreate these tables and plots in this [notebook]({notebook_url}) and more discussions in this blog [post](https://lmsys.org/blog/2023-12-07-leaderboard/).
|
396 |
""",
|
397 |
elem_id="leaderboard_markdown"
|
398 |
)
|
|
|
400 |
leader_component_values[:] = [default_md, p1, p2, p3, p4]
|
401 |
|
402 |
if show_plot:
|
403 |
+
# more_stats_md = gr.Markdown(
|
404 |
+
# f"""## More Statistics for Chatbot Arena (Overall)""",
|
405 |
+
# elem_id="leaderboard_markdown"
|
406 |
+
# )
|
407 |
+
more_stats_md = gr.Button("More Statistics for Chatbot Arena (Overall)", elem_id="non-interactive-button")
|
|
|
|
|
408 |
with gr.Row():
|
409 |
with gr.Column():
|
410 |
gr.Markdown(
|
411 |
+
"#### Figure 1: Fraction of Model A Wins for All Non-tied A vs. B Battles", elem_id="plot-title", variant="panel"
|
412 |
)
|
413 |
+
plot_1 = gr.Plot(p1, show_label=False, elem_id="plot-container")
|
414 |
with gr.Column():
|
415 |
gr.Markdown(
|
416 |
+
"#### Figure 2: Battle Count for Each Combination of Models (without Ties)", elem_id="plot-title"
|
417 |
)
|
418 |
plot_2 = gr.Plot(p2, show_label=False)
|
419 |
with gr.Row():
|
420 |
with gr.Column():
|
421 |
gr.Markdown(
|
422 |
+
"#### Figure 3: Confidence Intervals on Model Strength (via Bootstrapping)", elem_id="plot-title"
|
423 |
)
|
424 |
plot_3 = gr.Plot(p3, show_label=False)
|
425 |
with gr.Column():
|
426 |
gr.Markdown(
|
427 |
+
"#### Figure 4: Average Win Rate Against All Other Models (Assuming Uniform Sampling and No Ties)", elem_id="plot-title"
|
428 |
)
|
429 |
plot_4 = gr.Plot(p4, show_label=False)
|
430 |
+
|
431 |
+
overall_rating.click(fn=update_overall_rating_df, inputs=overall_rating, outputs=[elo_display_df, plot_1, plot_2, plot_3, plot_4, more_stats_md, leaderboard_markdown])
|
432 |
+
english_rating.click(fn=update_english_rating_df, inputs=english_rating, outputs=[elo_display_df, plot_1, plot_2, plot_3, plot_4, more_stats_md, leaderboard_markdown])
|
433 |
+
chinese_rating.click(fn=update_chinese_rating_df, inputs=chinese_rating ,outputs=[elo_display_df, plot_1, plot_2, plot_3, plot_4, more_stats_md, leaderboard_markdown])
|
434 |
+
long_context_rating.click(fn=update_long_context_rating_df, inputs=long_context_rating, outputs=[elo_display_df, plot_1, plot_2, plot_3, plot_4, more_stats_md, leaderboard_markdown])
|
435 |
|
436 |
gr.Markdown(acknowledgment_md)
|
437 |
|
|
|
439 |
return [md_1, plot_1, plot_2, plot_3, plot_4]
|
440 |
return [md_1]
|
441 |
|
442 |
+
|
443 |
block_css = """
|
444 |
#notice_markdown {
|
445 |
font-size: 104%
|
|
|
458 |
padding-top: 6px;
|
459 |
padding-bottom: 6px;
|
460 |
}
|
461 |
+
|
462 |
#leaderboard_dataframe td {
|
463 |
line-height: 0.1em;
|
464 |
}
|
465 |
+
|
466 |
+
#plot-title {
|
467 |
+
text-align: center;
|
468 |
+
display:block;
|
469 |
+
}
|
470 |
+
|
471 |
+
#non-interactive-button {
|
472 |
+
display: inline-block;
|
473 |
+
padding: 10px 10px;
|
474 |
+
background-color: #f7f7f7; /* Super light grey background */
|
475 |
+
color: #000000; /* Black text */
|
476 |
+
text-align: center;
|
477 |
+
font-size: 26px; /* Larger text */
|
478 |
+
border-radius: 0; /* Straight edges, no border radius */
|
479 |
+
border: 0px solid #dcdcdc; /* A light grey border to match the background */
|
480 |
+
font-weight: bold;
|
481 |
+
user-select: none; /* The text inside the button is not selectable */
|
482 |
+
pointer-events: none; /* The button is non-interactive */
|
483 |
+
}
|
484 |
+
|
485 |
footer {
|
486 |
display:none !important
|
487 |
}
|
|
|
511 |
|
512 |
def build_demo(elo_results_file, leaderboard_table_file):
|
513 |
text_size = gr.themes.sizes.text_lg
|
514 |
+
theme = gr.themes.Base(text_size=text_size)
|
515 |
+
theme.set(button_secondary_background_fill_hover="*primary_300", button_secondary_background_fill_hover_dark="*primary_700")
|
516 |
with gr.Blocks(
|
517 |
title="Chatbot Arena Leaderboard",
|
518 |
+
theme=theme,
|
519 |
+
# theme = gr.themes.Base.load("theme.json"),
|
520 |
css=block_css,
|
521 |
) as demo:
|
522 |
leader_components = build_leaderboard_tab(
|
theme.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"theme": {"_font": [{"__gradio_font__": true, "name": "Rubik", "class": "google"}, {"__gradio_font__": true, "name": "ui-sans-serif", "class": "font"}, {"__gradio_font__": true, "name": "system-ui", "class": "font"}, {"__gradio_font__": true, "name": "sans-serif", "class": "font"}], "_font_mono": [{"__gradio_font__": true, "name": "Inconsolata", "class": "google"}, {"__gradio_font__": true, "name": "ui-monospace", "class": "font"}, {"__gradio_font__": true, "name": "Consolas", "class": "font"}, {"__gradio_font__": true, "name": "monospace", "class": "font"}], "_stylesheets": ["https://fonts.googleapis.com/css2?family=Rubik:wght@400;500&display=swap", "https://fonts.googleapis.com/css2?family=Inconsolata:wght@400;500&display=swap"], "text_size": "20px", "background_fill_primary": "white", "background_fill_primary_dark": "*neutral_950", "background_fill_secondary": "*neutral_50", "background_fill_secondary_dark": "*neutral_900", "block_background_fill": "*background_fill_primary", "block_background_fill_dark": "*neutral_800", "block_border_color": "*border_color_primary", "block_border_color_dark": "*border_color_primary", "block_border_width": "1px", "block_border_width_dark": "1px", "block_info_text_color": "*body_text_color_subdued", "block_info_text_color_dark": "*body_text_color_subdued", "block_info_text_size": "*text_sm", "block_info_text_weight": "400", "block_label_background_fill": "*background_fill_primary", "block_label_background_fill_dark": "*background_fill_secondary", "block_label_border_color": "*border_color_primary", "block_label_border_color_dark": "*border_color_primary", "block_label_border_width": "1px", "block_label_border_width_dark": "1px", "block_label_margin": "0", "block_label_padding": "*spacing_sm *spacing_lg", "block_label_radius": "calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0", "block_label_right_radius": "0 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)", "block_label_shadow": "*block_shadow", "block_label_text_color": "*neutral_500", "block_label_text_color_dark": "*neutral_200", "block_label_text_size": "*text_sm", "block_label_text_weight": "400", "block_padding": "*spacing_xl calc(*spacing_xl + 2px)", "block_radius": "*radius_lg", "block_shadow": "none", "block_shadow_dark": "none", "block_title_background_fill": "none", "block_title_background_fill_dark": "none", "block_title_border_color": "none", "block_title_border_color_dark": "none", "block_title_border_width": "0px", "block_title_border_width_dark": "0px", "block_title_padding": "0", "block_title_radius": "none", "block_title_text_color": "*neutral_500", "block_title_text_color_dark": "*neutral_200", "block_title_text_size": "*text_md", "block_title_text_weight": "400", "body_background_fill": "*background_fill_primary", "body_background_fill_dark": "*background_fill_primary", "body_text_color": "*neutral_700", "body_text_color_dark": "*neutral_200", "body_text_color_subdued": "*neutral_400", "body_text_color_subdued_dark": "*neutral_500", "body_text_size": "*text_md", "body_text_weight": "400", "border_color_accent": "*primary_300", "border_color_accent_dark": "*neutral_600", "border_color_primary": "*neutral_200", "border_color_primary_dark": "*neutral_700", "button_border_width": "*input_border_width", "button_border_width_dark": "*input_border_width", "button_cancel_background_fill": "*button_secondary_background_fill", "button_cancel_background_fill_dark": "*button_secondary_background_fill", "button_cancel_background_fill_hover": "*button_cancel_background_fill", "button_cancel_background_fill_hover_dark": "*button_cancel_background_fill", "button_cancel_border_color": "*button_secondary_border_color", "button_cancel_border_color_dark": "*button_secondary_border_color", "button_cancel_border_color_hover": "*button_cancel_border_color", "button_cancel_border_color_hover_dark": "*button_cancel_border_color", "button_cancel_text_color": "*button_secondary_text_color", "button_cancel_text_color_dark": "*button_secondary_text_color", "button_cancel_text_color_hover": "*button_cancel_text_color", "button_cancel_text_color_hover_dark": "*button_cancel_text_color", "button_large_padding": "*spacing_lg calc(2 * *spacing_lg)", "button_large_radius": "*radius_lg", "button_large_text_size": "*text_lg", "button_large_text_weight": "500", "button_primary_background_fill": "*primary_200", "button_primary_background_fill_dark": "*primary_700", "button_primary_background_fill_hover": "*button_primary_background_fill", "button_primary_background_fill_hover_dark": "*button_primary_background_fill", "button_primary_border_color": "*primary_200", "button_primary_border_color_dark": "*primary_600", "button_primary_border_color_hover": "*button_primary_border_color", "button_primary_border_color_hover_dark": "*button_primary_border_color", "button_primary_text_color": "*primary_600", "button_primary_text_color_dark": "white", "button_primary_text_color_hover": "*button_primary_text_color", "button_primary_text_color_hover_dark": "*button_primary_text_color", "button_secondary_background_fill": "*neutral_200", "button_secondary_background_fill_dark": "*neutral_600", "button_secondary_background_fill_hover": "*neutral_300", "button_secondary_background_fill_hover_dark": "*neutral_500", "button_secondary_border_color": "*neutral_200", "button_secondary_border_color_dark": "*neutral_600", "button_secondary_border_color_hover": "*button_secondary_border_color", "button_secondary_border_color_hover_dark": "*button_secondary_border_color", "button_secondary_text_color": "*neutral_700", "button_secondary_text_color_dark": "white", "button_secondary_text_color_hover": "*button_secondary_text_color", "button_secondary_text_color_hover_dark": "*button_secondary_text_color", "button_shadow": "none", "button_shadow_active": "none", "button_shadow_hover": "none", "button_small_padding": "*spacing_sm calc(2 * *spacing_sm)", "button_small_radius": "*radius_lg", "button_small_text_size": "*text_md", "button_small_text_weight": "400", "button_transition": "background-color 0.2s ease", "checkbox_background_color": "*background_fill_primary", "checkbox_background_color_dark": "*neutral_800", "checkbox_background_color_focus": "*checkbox_background_color", "checkbox_background_color_focus_dark": "*checkbox_background_color", "checkbox_background_color_hover": "*checkbox_background_color", "checkbox_background_color_hover_dark": "*checkbox_background_color", "checkbox_background_color_selected": "*secondary_600", "checkbox_background_color_selected_dark": "*secondary_600", "checkbox_border_color": "*neutral_300", "checkbox_border_color_dark": "*neutral_700", "checkbox_border_color_focus": "*secondary_500", "checkbox_border_color_focus_dark": "*secondary_500", "checkbox_border_color_hover": "*neutral_300", "checkbox_border_color_hover_dark": "*neutral_600", "checkbox_border_color_selected": "*secondary_600", "checkbox_border_color_selected_dark": "*secondary_600", "checkbox_border_radius": "*radius_sm", "checkbox_border_width": "*input_border_width", "checkbox_border_width_dark": "*input_border_width", "checkbox_check": "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")", "checkbox_label_background_fill": "*button_secondary_background_fill", "checkbox_label_background_fill_dark": "*button_secondary_background_fill", "checkbox_label_background_fill_hover": "*button_secondary_background_fill_hover", "checkbox_label_background_fill_hover_dark": "*button_secondary_background_fill_hover", "checkbox_label_background_fill_selected": "*checkbox_label_background_fill", "checkbox_label_background_fill_selected_dark": "*checkbox_label_background_fill", "checkbox_label_border_color": "*border_color_primary", "checkbox_label_border_color_dark": "*border_color_primary", "checkbox_label_border_color_hover": "*checkbox_label_border_color", "checkbox_label_border_color_hover_dark": "*checkbox_label_border_color", "checkbox_label_border_width": "*input_border_width", "checkbox_label_border_width_dark": "*input_border_width", "checkbox_label_gap": "*spacing_lg", "checkbox_label_padding": "*spacing_md calc(2 * *spacing_md)", "checkbox_label_shadow": "none", "checkbox_label_text_color": "*body_text_color", "checkbox_label_text_color_dark": "*body_text_color", "checkbox_label_text_color_selected": "*checkbox_label_text_color", "checkbox_label_text_color_selected_dark": "*checkbox_label_text_color", "checkbox_label_text_size": "*text_md", "checkbox_label_text_weight": "400", "checkbox_shadow": "*input_shadow", "color_accent": "*primary_500", "color_accent_soft": "*primary_50", "color_accent_soft_dark": "*neutral_700", "container_radius": "*radius_lg", "embed_radius": "*radius_md", "error_background_fill": "#fee2e2", "error_background_fill_dark": "*background_fill_primary", "error_border_color": "#fecaca", "error_border_color_dark": "*border_color_primary", "error_border_width": "1px", "error_border_width_dark": "1px", "error_text_color": "#ef4444", "error_text_color_dark": "#ef4444", "font": "'Rubik', 'ui-sans-serif', 'system-ui', sans-serif", "font_mono": "'Inconsolata', 'ui-monospace', 'Consolas', monospace", "form_gap_width": "0px", "input_background_fill": "*neutral_100", "input_background_fill_dark": "*neutral_700", "input_background_fill_focus": "*secondary_500", "input_background_fill_focus_dark": "*secondary_600", "input_background_fill_hover": "*input_background_fill", "input_background_fill_hover_dark": "*input_background_fill", "input_border_color": "*border_color_primary", "input_border_color_dark": "*border_color_primary", "input_border_color_focus": "*secondary_300", "input_border_color_focus_dark": "*neutral_700", "input_border_color_hover": "*input_border_color", "input_border_color_hover_dark": "*input_border_color", "input_border_width": "0px", "input_border_width_dark": "0px", "input_padding": "*spacing_xl", "input_placeholder_color": "*neutral_400", "input_placeholder_color_dark": "*neutral_500", "input_radius": "*radius_lg", "input_shadow": "none", "input_shadow_dark": "none", "input_shadow_focus": "*input_shadow", "input_shadow_focus_dark": "*input_shadow", "input_text_size": "*text_md", "input_text_weight": "400", "layout_gap": "*spacing_xxl", "link_text_color": "*secondary_600", "link_text_color_active": "*secondary_600", "link_text_color_active_dark": "*secondary_500", "link_text_color_dark": "*secondary_500", "link_text_color_hover": "*secondary_700", "link_text_color_hover_dark": "*secondary_400", "link_text_color_visited": "*secondary_500", "link_text_color_visited_dark": "*secondary_600", "loader_color": "*color_accent", "loader_color_dark": "*color_accent", "name": "base", "neutral_100": "#f5f5f4", "neutral_200": "#e7e5e4", "neutral_300": "#d6d3d1", "neutral_400": "#a8a29e", "neutral_50": "#fafaf9", "neutral_500": "#78716c", "neutral_600": "#57534e", "neutral_700": "#44403c", "neutral_800": "#292524", "neutral_900": "#1c1917", "neutral_950": "#0f0e0d", "panel_background_fill": "*background_fill_secondary", "panel_background_fill_dark": "*background_fill_secondary", "panel_border_color": "*border_color_primary", "panel_border_color_dark": "*border_color_primary", "panel_border_width": "0", "panel_border_width_dark": "0", "primary_100": "#e0f2fe", "primary_200": "#bae6fd", "primary_300": "#7dd3fc", "primary_400": "#38bdf8", "primary_50": "#f0f9ff", "primary_500": "#0ea5e9", "primary_600": "#0284c7", "primary_700": "#0369a1", "primary_800": "#075985", "primary_900": "#0c4a6e", "primary_950": "#0b4165", "prose_header_text_weight": "500", "prose_text_size": "*text_md", "prose_text_weight": "400", "radio_circle": "url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")", "radius_lg": "3px", "radius_md": "3px", "radius_sm": "3px", "radius_xl": "3px", "radius_xs": "3px", "radius_xxl": "3px", "radius_xxs": "3px", "secondary_100": "#e0f2fe", "secondary_200": "#bae6fd", "secondary_300": "#7dd3fc", "secondary_400": "#38bdf8", "secondary_50": "#f0f9ff", "secondary_500": "#0ea5e9", "secondary_600": "#0284c7", "secondary_700": "#0369a1", "secondary_800": "#075985", "secondary_900": "#0c4a6e", "secondary_950": "#0b4165", "section_header_text_size": "*text_md", "section_header_text_weight": "400", "shadow_drop": "rgba(0,0,0,0.05) 0px 1px 2px 0px", "shadow_drop_lg": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)", "shadow_inset": "rgba(0,0,0,0.05) 0px 2px 4px 0px inset", "shadow_spread": "3px", "shadow_spread_dark": "1px", "slider_color": "*primary_600", "slider_color_dark": "*primary_600", "spacing_lg": "8px", "spacing_md": "6px", "spacing_sm": "4px", "spacing_xl": "10px", "spacing_xs": "2px", "spacing_xxl": "16px", "spacing_xxs": "1px", "stat_background_fill": "*primary_300", "stat_background_fill_dark": "*primary_500", "table_border_color": "*neutral_300", "table_border_color_dark": "*neutral_700", "table_even_background_fill": "white", "table_even_background_fill_dark": "*neutral_950", "table_odd_background_fill": "*neutral_50", "table_odd_background_fill_dark": "*neutral_900", "table_radius": "*radius_lg", "table_row_focus": "*color_accent_soft", "table_row_focus_dark": "*color_accent_soft", "text_lg": "20px", "text_md": "16px", "text_sm": "14px", "text_xl": "24px", "text_xs": "12px", "text_xxl": "28px", "text_xxs": "10px"}, "version": "0.0.1"}
|