Spaces:
Sleeping
Sleeping
Update src/saving_utils.py
Browse files- src/saving_utils.py +13 -0
src/saving_utils.py
CHANGED
@@ -6,6 +6,19 @@ from huggingface_hub import HfApi
|
|
6 |
script_dir = os.path.dirname(os.path.abspath(__file__)) # Directory of the running script
|
7 |
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
def save_results(method_name, benchmark_types, results, repo_id="mgyigit/probe-data", repo_type="space"):
|
10 |
#First, download files to be updated from {repo_id}
|
11 |
download_from_hub(benchmark_types, repo_id, repo_type)
|
|
|
6 |
script_dir = os.path.dirname(os.path.abspath(__file__)) # Directory of the running script
|
7 |
|
8 |
|
9 |
+
|
10 |
+
def get_baseline_df(selected_methods, selected_metrics, leaderboard_path="/tmp/leaderboard_results.csv"):
|
11 |
+
if not os.path.exists(leaderboard_path):
|
12 |
+
benchmark_types = [] #only download leaderboard
|
13 |
+
download_from_hub(benchmark_types)
|
14 |
+
|
15 |
+
leaderboard_df = pd.read_csv(leaderboard_path)
|
16 |
+
|
17 |
+
present_columns = ["method_name"] + selected_metrics
|
18 |
+
leaderboard_df = leaderboard_df[leaderboard_df['method_name'].isin(selected_methods)][present_columns]
|
19 |
+
return leaderboard_df
|
20 |
+
|
21 |
+
|
22 |
def save_results(method_name, benchmark_types, results, repo_id="mgyigit/probe-data", repo_type="space"):
|
23 |
#First, download files to be updated from {repo_id}
|
24 |
download_from_hub(benchmark_types, repo_id, repo_type)
|