Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from glob import glob
|
|
| 7 |
eval_results_dir = "eval_results/" # Directory containing evaluation results
|
| 8 |
|
| 9 |
def load_results():
|
| 10 |
-
records =
|
| 11 |
|
| 12 |
# Recursively find all JSON files in the eval_results directory
|
| 13 |
json_files = glob(os.path.join(eval_results_dir, "**", "*.json"), recursive=True)
|
|
@@ -19,21 +19,21 @@ def load_results():
|
|
| 19 |
model_name = data["config_general"].get("model_name", "Unknown")
|
| 20 |
results = data.get("results", {})
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
# Extract relevant evaluation metrics
|
| 23 |
for task, task_data in results.items():
|
| 24 |
if "extractive_match" in task_data:
|
| 25 |
-
records
|
| 26 |
-
|
| 27 |
-
"Task": task,
|
| 28 |
-
"Extractive Match": task_data["extractive_match"],
|
| 29 |
-
"Std Err": task_data["extractive_match_stderr"]
|
| 30 |
-
})
|
| 31 |
except Exception as e:
|
| 32 |
print(f"Error reading {file_path}: {e}")
|
| 33 |
|
| 34 |
# Convert to DataFrame
|
| 35 |
-
df = pd.DataFrame(records)
|
| 36 |
-
|
|
|
|
| 37 |
|
| 38 |
def leaderboard():
|
| 39 |
df = load_results()
|
|
|
|
| 7 |
eval_results_dir = "eval_results/" # Directory containing evaluation results
|
| 8 |
|
| 9 |
def load_results():
|
| 10 |
+
records = {}
|
| 11 |
|
| 12 |
# Recursively find all JSON files in the eval_results directory
|
| 13 |
json_files = glob(os.path.join(eval_results_dir, "**", "*.json"), recursive=True)
|
|
|
|
| 19 |
model_name = data["config_general"].get("model_name", "Unknown")
|
| 20 |
results = data.get("results", {})
|
| 21 |
|
| 22 |
+
if model_name not in records:
|
| 23 |
+
records[model_name] = {}
|
| 24 |
+
|
| 25 |
# Extract relevant evaluation metrics
|
| 26 |
for task, task_data in results.items():
|
| 27 |
if "extractive_match" in task_data:
|
| 28 |
+
records[model_name][f"{task} (Match)"] = task_data["extractive_match"]
|
| 29 |
+
records[model_name][f"{task} (StdErr)"] = task_data["extractive_match_stderr"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
except Exception as e:
|
| 31 |
print(f"Error reading {file_path}: {e}")
|
| 32 |
|
| 33 |
# Convert to DataFrame
|
| 34 |
+
df = pd.DataFrame.from_dict(records, orient="index").reset_index()
|
| 35 |
+
df.rename(columns={"index": "Model"}, inplace=True)
|
| 36 |
+
return df
|
| 37 |
|
| 38 |
def leaderboard():
|
| 39 |
df = load_results()
|