fixes
Browse files- app.py +10 -4
- src/display/css_html_js.py +3 -1
- src/populate.py +12 -2
app.py
CHANGED
|
@@ -72,13 +72,17 @@ def hide_skill_columns(dataframe, exceptions=[]):
|
|
| 72 |
|
| 73 |
def perform_cell_formatting(dataframe):
|
| 74 |
|
| 75 |
-
|
| 76 |
lambda rows: [
|
| 77 |
"background-color: red;color: white !important" if (value >0) else "color: green !important;" for value in rows
|
| 78 |
],
|
| 79 |
subset=["Contamination Score"],
|
|
|
|
| 80 |
)
|
| 81 |
|
|
|
|
|
|
|
|
|
|
| 82 |
def make_column_bold(df_col):
|
| 83 |
return df_col.apply(lambda x: "<b>"+str(x)+"</b>")
|
| 84 |
|
|
@@ -86,13 +90,15 @@ def init_leaderboard(dataframe):
|
|
| 86 |
|
| 87 |
dataframe = hide_skill_columns(dataframe)
|
| 88 |
|
| 89 |
-
|
| 90 |
-
dataframe["Benchmark Score (0-10)"] = make_column_bold(dataframe["Benchmark Score (0-10)"])
|
|
|
|
| 91 |
|
| 92 |
styler = perform_cell_formatting(dataframe)
|
| 93 |
|
| 94 |
|
| 95 |
|
|
|
|
| 96 |
return gr.Dataframe(
|
| 97 |
value=styler,
|
| 98 |
datatype="markdown",
|
|
@@ -146,7 +152,7 @@ def init_size_leaderboard(dataframe):
|
|
| 146 |
|
| 147 |
dataframe = hide_skill_columns(dataframe)
|
| 148 |
|
| 149 |
-
dataframe["Benchmark Score (0-10)"] = make_column_bold(dataframe["Benchmark Score (0-10)"])
|
| 150 |
|
| 151 |
size_keys = ["Large","Medium","Small","Nano"]
|
| 152 |
|
|
|
|
| 72 |
|
| 73 |
def perform_cell_formatting(dataframe):
|
| 74 |
|
| 75 |
+
styler = dataframe.style.format(precision=2, decimal=".").apply(
|
| 76 |
lambda rows: [
|
| 77 |
"background-color: red;color: white !important" if (value >0) else "color: green !important;" for value in rows
|
| 78 |
],
|
| 79 |
subset=["Contamination Score"],
|
| 80 |
+
axis=1
|
| 81 |
)
|
| 82 |
|
| 83 |
+
return styler
|
| 84 |
+
|
| 85 |
+
|
| 86 |
def make_column_bold(df_col):
|
| 87 |
return df_col.apply(lambda x: "<b>"+str(x)+"</b>")
|
| 88 |
|
|
|
|
| 90 |
|
| 91 |
dataframe = hide_skill_columns(dataframe)
|
| 92 |
|
| 93 |
+
|
| 94 |
+
dataframe.loc[:,"Benchmark Score (0-10)"] = make_column_bold(dataframe["Benchmark Score (0-10)"])
|
| 95 |
+
|
| 96 |
|
| 97 |
styler = perform_cell_formatting(dataframe)
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
+
|
| 102 |
return gr.Dataframe(
|
| 103 |
value=styler,
|
| 104 |
datatype="markdown",
|
|
|
|
| 152 |
|
| 153 |
dataframe = hide_skill_columns(dataframe)
|
| 154 |
|
| 155 |
+
dataframe.loc[:,"Benchmark Score (0-10)"] = make_column_bold(dataframe["Benchmark Score (0-10)"])
|
| 156 |
|
| 157 |
size_keys = ["Large","Medium","Small","Nano"]
|
| 158 |
|
src/display/css_html_js.py
CHANGED
|
@@ -132,7 +132,9 @@ border-radius: 10px;
|
|
| 132 |
|
| 133 |
|
| 134 |
.ddm-value{
|
| 135 |
-
color:#
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
|
| 138 |
|
|
|
|
| 132 |
|
| 133 |
|
| 134 |
.ddm-value{
|
| 135 |
+
color:#4c78a8 !important;
|
| 136 |
+
font-weight:bold !important;
|
| 137 |
+
margin-top: 10px;
|
| 138 |
}
|
| 139 |
|
| 140 |
|
src/populate.py
CHANGED
|
@@ -14,7 +14,7 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
| 14 |
all_data_json = [v.to_dict() for v in raw_data]
|
| 15 |
|
| 16 |
df = pd.DataFrame.from_records(all_data_json)
|
| 17 |
-
|
| 18 |
if not df.empty:
|
| 19 |
df = df.sort_values(by=[AutoEvalColumn.average_score.name], ascending=False)
|
| 20 |
|
|
@@ -23,10 +23,20 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
| 23 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
| 24 |
|
| 25 |
df.insert(0, "Rank", range(1, len(df) + 1))
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
print("###############\n\n\n\n\n\n###############")
|
| 28 |
|
| 29 |
print(df)
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
return df
|
|
|
|
| 14 |
all_data_json = [v.to_dict() for v in raw_data]
|
| 15 |
|
| 16 |
df = pd.DataFrame.from_records(all_data_json)
|
| 17 |
+
|
| 18 |
if not df.empty:
|
| 19 |
df = df.sort_values(by=[AutoEvalColumn.average_score.name], ascending=False)
|
| 20 |
|
|
|
|
| 23 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
| 24 |
|
| 25 |
df.insert(0, "Rank", range(1, len(df) + 1))
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
##round any float column
|
| 29 |
+
for col in df.columns:
|
| 30 |
+
if df[col].dtype == "float64":
|
| 31 |
+
df[col] = df[col].round(2)
|
| 32 |
+
|
| 33 |
+
df["Benchmark Score (0-10)"] = df["Benchmark Score (0-10)"].astype(str)
|
| 34 |
+
print(df["Benchmark Score (0-10)"])
|
| 35 |
+
|
| 36 |
print("###############\n\n\n\n\n\n###############")
|
| 37 |
|
| 38 |
print(df)
|
| 39 |
+
print(df.info())
|
| 40 |
|
| 41 |
|
| 42 |
return df
|