Spaces:
Runtime error
Runtime error
removed run id
Browse files- app.py +1 -1
- src/display/utils.py +1 -2
- src/leaderboard/read_evals.py +2 -2
app.py
CHANGED
|
@@ -48,7 +48,7 @@ def init_leaderboard(dataframe):
|
|
| 48 |
cant_deselect=[c.name for c in fields(AutoEvalColumn) if c.never_hidden],
|
| 49 |
label="Select Columns to Display:",
|
| 50 |
),
|
| 51 |
-
search_columns=[AutoEvalColumn.
|
| 52 |
hide_columns=[c.name for c in fields(AutoEvalColumn) if c.hidden],
|
| 53 |
filter_columns=[
|
| 54 |
ColumnFilter(AutoEvalColumn.technique.name, type = "checkboxgroup", label = "technique"),
|
|
|
|
| 48 |
cant_deselect=[c.name for c in fields(AutoEvalColumn) if c.never_hidden],
|
| 49 |
label="Select Columns to Display:",
|
| 50 |
),
|
| 51 |
+
search_columns=[AutoEvalColumn.technique.name],
|
| 52 |
hide_columns=[c.name for c in fields(AutoEvalColumn) if c.hidden],
|
| 53 |
filter_columns=[
|
| 54 |
ColumnFilter(AutoEvalColumn.technique.name, type = "checkboxgroup", label = "technique"),
|
src/display/utils.py
CHANGED
|
@@ -17,9 +17,8 @@ class ColumnContent:
|
|
| 17 |
|
| 18 |
## Leaderboard columns
|
| 19 |
# manually create class instead of using make_dataclass as our columns are not built dynamically,
|
| 20 |
-
# the given and known cols are the
|
| 21 |
class AutoEvalColumn:
|
| 22 |
-
run_id = ColumnContent("run_id", "str", True, never_hidden = True)
|
| 23 |
technique = ColumnContent("technique", "str", True, never_hidden = True)
|
| 24 |
|
| 25 |
# Column selection
|
|
|
|
| 17 |
|
| 18 |
## Leaderboard columns
|
| 19 |
# manually create class instead of using make_dataclass as our columns are not built dynamically,
|
| 20 |
+
# the given and known cols are the techniques, based on our results json file
|
| 21 |
class AutoEvalColumn:
|
|
|
|
| 22 |
technique = ColumnContent("technique", "str", True, never_hidden = True)
|
| 23 |
|
| 24 |
# Column selection
|
src/leaderboard/read_evals.py
CHANGED
|
@@ -11,14 +11,14 @@ def get_raw_eval_results(results_path: str, requests_path: str) -> pd.DataFrame:
|
|
| 11 |
"""Reads all result json files in the leaderboard result file path, returns DataFrame
|
| 12 |
The DataFrame contains rows, where each row is result from each run
|
| 13 |
Headers for each row:
|
| 14 |
-
|
| 15 |
files = glob.glob(os.path.join(results_path, "**/*.json"), recursive = True)
|
| 16 |
data_rows = []
|
| 17 |
|
| 18 |
for file in files: # each json file has its own row in the data frame
|
| 19 |
with open(file, 'r') as file_json:
|
| 20 |
data = json.load(file_json)
|
| 21 |
-
row = {"
|
| 22 |
for eval_method, result in data.get("metric_results", {}).items(): # used .get() to prevent KeyError
|
| 23 |
row[eval_method] = result.get('value') # multiple eval results under metric results
|
| 24 |
data_rows.append(row)
|
|
|
|
| 11 |
"""Reads all result json files in the leaderboard result file path, returns DataFrame
|
| 12 |
The DataFrame contains rows, where each row is result from each run
|
| 13 |
Headers for each row:
|
| 14 |
+
technique, eval_method_1_results, eval_method_2_results, ..."""
|
| 15 |
files = glob.glob(os.path.join(results_path, "**/*.json"), recursive = True)
|
| 16 |
data_rows = []
|
| 17 |
|
| 18 |
for file in files: # each json file has its own row in the data frame
|
| 19 |
with open(file, 'r') as file_json:
|
| 20 |
data = json.load(file_json)
|
| 21 |
+
row = {"technique": data.get("technique_name", None)} # metric result is a nested dict
|
| 22 |
for eval_method, result in data.get("metric_results", {}).items(): # used .get() to prevent KeyError
|
| 23 |
row[eval_method] = result.get('value') # multiple eval results under metric results
|
| 24 |
data_rows.append(row)
|