Spaces:
Running
Running
Commit
•
d46be0d
1
Parent(s):
10753ac
Fix overflow on small screens
Browse files- app.py +1 -1
- src/details.py +13 -10
app.py
CHANGED
@@ -29,7 +29,7 @@ from src.results import (
|
|
29 |
result_paths_per_model = sort_result_paths_per_model(fetch_result_paths())
|
30 |
load_results_dataframes = partial(load_results_dataframes, result_paths_per_model=result_paths_per_model)
|
31 |
|
32 |
-
with gr.Blocks(fill_height=True, fill_width=True) as demo:
|
33 |
gr.HTML("<h1 style='text-align: center;'>Compare Results of the 🤗 Open LLM Leaderboard</h1>")
|
34 |
gr.HTML("<h3 style='text-align: center;'>Select 2 models to load and compare their results</h3>")
|
35 |
gr.HTML(
|
|
|
29 |
result_paths_per_model = sort_result_paths_per_model(fetch_result_paths())
|
30 |
load_results_dataframes = partial(load_results_dataframes, result_paths_per_model=result_paths_per_model)
|
31 |
|
32 |
+
with gr.Blocks(fill_height=True, fill_width=True, css=".col_heading {width: 50%}") as demo:
|
33 |
gr.HTML("<h1 style='text-align: center;'>Compare Results of the 🤗 Open LLM Leaderboard</h1>")
|
34 |
gr.HTML("<h3 style='text-align: center;'>Select 2 models to load and compare their results</h3>")
|
35 |
gr.HTML(
|
src/details.py
CHANGED
@@ -74,23 +74,26 @@ def display_details(sample_idx, show_only_differences, *dfs):
|
|
74 |
# Pop model_name and add it to the column name
|
75 |
df = pd.concat([row.rename(row.pop("model_name")) for row in rows], axis="columns")
|
76 |
|
77 |
-
#
|
78 |
-
|
79 |
-
|
80 |
-
result = row.str.wrap(140)
|
81 |
-
return result if result.notna().all() else row # NaN when data is a list
|
82 |
-
except AttributeError: # when data is number
|
83 |
-
return row
|
84 |
-
|
85 |
-
df = df.apply(wrap, axis=1)
|
86 |
if show_only_differences:
|
87 |
any_difference = df.ne(df.iloc[:, 0], axis=0).any(axis=1)
|
88 |
-
|
89 |
return (
|
90 |
df.style.format(escape="html", na_rep="")
|
91 |
# .hide(axis="index")
|
92 |
# Hide non-different rows
|
93 |
.hide([row for row in df.index if show_only_differences and not any_difference[row]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
.to_html()
|
95 |
)
|
96 |
|
|
|
74 |
# Pop model_name and add it to the column name
|
75 |
df = pd.concat([row.rename(row.pop("model_name")) for row in rows], axis="columns")
|
76 |
|
77 |
+
# Style
|
78 |
+
# - Option: Show only differences
|
79 |
+
any_difference = pd.Series(False, index=df.index)
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
if show_only_differences:
|
81 |
any_difference = df.ne(df.iloc[:, 0], axis=0).any(axis=1)
|
82 |
+
|
83 |
return (
|
84 |
df.style.format(escape="html", na_rep="")
|
85 |
# .hide(axis="index")
|
86 |
# Hide non-different rows
|
87 |
.hide([row for row in df.index if show_only_differences and not any_difference[row]])
|
88 |
+
# Fix overflow
|
89 |
+
.set_table_styles(
|
90 |
+
[
|
91 |
+
{
|
92 |
+
"selector": "td",
|
93 |
+
"props": [("overflow-wrap", "break-word"), ("max-width", "1px")],
|
94 |
+
}
|
95 |
+
]
|
96 |
+
)
|
97 |
.to_html()
|
98 |
)
|
99 |
|