Spaces:
Sleeping
Sleeping
Update src/saving_utils.py
Browse files- src/saving_utils.py +12 -2
src/saving_utils.py
CHANGED
|
@@ -1,7 +1,16 @@
|
|
| 1 |
import os
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# Load or initialize the DataFrames
|
| 6 |
if os.path.exists(leaderboard_path):
|
| 7 |
leaderboard_df = pd.read_csv(leaderboard_path)
|
|
@@ -68,7 +77,8 @@ def save_similarity_output(output_dict, method_name, leaderboard_path="/home/use
|
|
| 68 |
# Save the updated DataFrames back to CSV
|
| 69 |
similarity_df.to_csv(similarity_path, index=False)
|
| 70 |
leaderboard_df.to_csv(leaderboard_path, index=False)
|
| 71 |
-
|
|
|
|
| 72 |
return 0
|
| 73 |
|
| 74 |
def save_function_output(model_output, method_name, func_results_path="/home/user/app/src/data/function_results.csv", leaderboard_path="/home/user/app/src/data/leaderboard_results.csv"):
|
|
|
|
| 1 |
import os
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
script_dir = os.path.dirname(os.path.abspath(__file__)) # Directory of the running script
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def save_similarity_output(output_dict, method_name, leaderboard_path="data/leaderboard_results.csv", similarity_path="data/similarity_results.csv"):
|
| 8 |
+
leaderboard_path = os.path.join(script_dir, leaderboard_path)
|
| 9 |
+
similarity_path = os.path.join(script_dir, similarity_path)
|
| 10 |
+
|
| 11 |
+
with open("test_write.txt", "w") as f:
|
| 12 |
+
f.write("Write test successful!")
|
| 13 |
+
|
| 14 |
# Load or initialize the DataFrames
|
| 15 |
if os.path.exists(leaderboard_path):
|
| 16 |
leaderboard_df = pd.read_csv(leaderboard_path)
|
|
|
|
| 77 |
# Save the updated DataFrames back to CSV
|
| 78 |
similarity_df.to_csv(similarity_path, index=False)
|
| 79 |
leaderboard_df.to_csv(leaderboard_path, index=False)
|
| 80 |
+
print(f"Updated files saved to {similarity_path} and {leaderboard_path}")
|
| 81 |
+
|
| 82 |
return 0
|
| 83 |
|
| 84 |
def save_function_output(model_output, method_name, func_results_path="/home/user/app/src/data/function_results.csv", leaderboard_path="/home/user/app/src/data/leaderboard_results.csv"):
|