tooltip
Browse files
app.py
CHANGED
@@ -56,16 +56,30 @@ def bold_max(s):
|
|
56 |
is_max = s == s.max() # Boolean Series: True for the max value(s)
|
57 |
return ['font-weight: bold' if v else '' for v in is_max]
|
58 |
|
59 |
-
def init_leaderboard(
|
60 |
-
if
|
61 |
raise ValueError("Leaderboard DataFrame is empty or None.")
|
62 |
|
63 |
AutoEvalColumnSubset = [c for c in fields(AutoEvalColumn) if ((c.name=="Model") or (TASK_NAME_INVERSE_MAP.get(c.name, dict()).get("type", "")==benchmark_type))]
|
64 |
|
65 |
# styler = dataframe.style.apply(bold_max, subset=pd.IndexSlice[:, dataframe.columns[1:]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
return gr.components.Dataframe(
|
68 |
-
value=
|
69 |
datatype=[c.type for c in AutoEvalColumnSubset],
|
70 |
column_widths=["150px" if c.name != "Model" else "250px" for c in AutoEvalColumnSubset],
|
71 |
wrap=False,
|
|
|
56 |
is_max = s == s.max() # Boolean Series: True for the max value(s)
|
57 |
return ['font-weight: bold' if v else '' for v in is_max]
|
58 |
|
59 |
+
def init_leaderboard(df, benchmark_type):
|
60 |
+
if df is None or df.empty:
|
61 |
raise ValueError("Leaderboard DataFrame is empty or None.")
|
62 |
|
63 |
AutoEvalColumnSubset = [c for c in fields(AutoEvalColumn) if ((c.name=="Model") or (TASK_NAME_INVERSE_MAP.get(c.name, dict()).get("type", "")==benchmark_type))]
|
64 |
|
65 |
# styler = dataframe.style.apply(bold_max, subset=pd.IndexSlice[:, dataframe.columns[1:]])
|
66 |
+
# df.style.set_table_styles([
|
67 |
+
# {'selector': 'th', 'props': [('text-align', 'center')]},
|
68 |
+
# {'selector': 'td', 'props': [('text-align', 'center')]}
|
69 |
+
# ])
|
70 |
+
# Define a common tooltip text
|
71 |
+
# tooltip_text = "This is the common tooltip"
|
72 |
+
|
73 |
+
# # Create a tooltip DataFrame with the same shape as df,
|
74 |
+
# # filled with the same tooltip text for each cell.
|
75 |
+
# tooltips = pd.DataFrame(tooltip_text, index=df.index, columns=df.columns)
|
76 |
+
|
77 |
+
# # Apply the tooltips to the DataFrame
|
78 |
+
# styled_df = df.style.set_tooltips(tooltips)
|
79 |
+
|
80 |
|
81 |
return gr.components.Dataframe(
|
82 |
+
value=df,
|
83 |
datatype=[c.type for c in AutoEvalColumnSubset],
|
84 |
column_widths=["150px" if c.name != "Model" else "250px" for c in AutoEvalColumnSubset],
|
85 |
wrap=False,
|