Update app.py
Browse files
app.py
CHANGED
@@ -87,9 +87,9 @@ def merge_data(uploaded_data_json):
|
|
87 |
else:
|
88 |
existing_data["SolvableWinRateScores"].append(new_entry)
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
94 |
# No need to sort here since we're doing it in the generate_table function
|
95 |
return existing_data
|
@@ -101,17 +101,17 @@ def process_file(file_info):
|
|
101 |
data_content = uploaded_file.read()
|
102 |
uploaded_data_json = json.loads(data_content)
|
103 |
# Merge the uploaded data
|
104 |
-
merge_data(uploaded_data_json)
|
105 |
scheduler.commit() # Trigger manual commit after processing
|
106 |
# If we don't return anything here, gradio will not update the table
|
107 |
# We need to return the new data for the table if it's interactive
|
108 |
-
pass_rate_table = generate_table(
|
109 |
-
win_rate_table = generate_table(
|
110 |
return pass_rate_table, win_rate_table
|
111 |
|
112 |
def refresh_table_data():
|
113 |
# 重新加载数据
|
114 |
-
new_data =
|
115 |
# 重新生成表格数据
|
116 |
new_pass_rate_data = generate_table(new_data["SolvablePassRateScores"])[1]
|
117 |
new_win_rate_data = generate_table(new_data["SolvableWinRateScores"])[1]
|
|
|
87 |
else:
|
88 |
existing_data["SolvableWinRateScores"].append(new_entry)
|
89 |
|
90 |
+
data_file_path = dataset_dir / "leaderboard_data.json"
|
91 |
+
with open(data_file_path, 'w') as file:
|
92 |
+
json.dump(existing_data, file, indent=4)
|
93 |
|
94 |
# No need to sort here since we're doing it in the generate_table function
|
95 |
return existing_data
|
|
|
101 |
data_content = uploaded_file.read()
|
102 |
uploaded_data_json = json.loads(data_content)
|
103 |
# Merge the uploaded data
|
104 |
+
new_data = merge_data(uploaded_data_json)
|
105 |
scheduler.commit() # Trigger manual commit after processing
|
106 |
# If we don't return anything here, gradio will not update the table
|
107 |
# We need to return the new data for the table if it's interactive
|
108 |
+
pass_rate_table = generate_table(new_data["SolvablePassRateScores"])[1]
|
109 |
+
win_rate_table = generate_table(new_data["SolvableWinRateScores"])[1]
|
110 |
return pass_rate_table, win_rate_table
|
111 |
|
112 |
def refresh_table_data():
|
113 |
# 重新加载数据
|
114 |
+
new_data = load_data()
|
115 |
# 重新生成表格数据
|
116 |
new_pass_rate_data = generate_table(new_data["SolvablePassRateScores"])[1]
|
117 |
new_win_rate_data = generate_table(new_data["SolvableWinRateScores"])[1]
|