Spaces:
Running
Running
Shiyu Zhao
commited on
Commit
·
aa3c137
1
Parent(s):
5ec5028
Update space
Browse files
app.py
CHANGED
@@ -240,11 +240,11 @@ def scan_submissions_directory():
|
|
240 |
repo_files = [f for f in all_files if f.startswith('submissions/')]
|
241 |
except Exception as e:
|
242 |
print(f"Error listing repository contents: {str(e)}")
|
243 |
-
return
|
244 |
|
245 |
if not repo_files:
|
246 |
print("No submissions directory found or empty")
|
247 |
-
return
|
248 |
|
249 |
# Group files by team folders
|
250 |
folder_files = {}
|
@@ -312,11 +312,36 @@ def scan_submissions_directory():
|
|
312 |
print(f"Error reading metadata for {folder_name}: {str(e)}")
|
313 |
continue
|
314 |
|
315 |
-
#
|
316 |
split = submission_data.get('Split')
|
317 |
if split in submissions_by_split:
|
318 |
submissions_by_split[split].append(submission_data)
|
319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
print(f"Successfully added submission from {folder_name} to {split} leaderboard")
|
321 |
else:
|
322 |
print(f"Invalid split '{split}' found in {folder_name}")
|
|
|
240 |
repo_files = [f for f in all_files if f.startswith('submissions/')]
|
241 |
except Exception as e:
|
242 |
print(f"Error listing repository contents: {str(e)}")
|
243 |
+
return submissions_by_split
|
244 |
|
245 |
if not repo_files:
|
246 |
print("No submissions directory found or empty")
|
247 |
+
return submissions_by_split
|
248 |
|
249 |
# Group files by team folders
|
250 |
folder_files = {}
|
|
|
312 |
print(f"Error reading metadata for {folder_name}: {str(e)}")
|
313 |
continue
|
314 |
|
315 |
+
# Map the split name if necessary
|
316 |
split = submission_data.get('Split')
|
317 |
if split in submissions_by_split:
|
318 |
submissions_by_split[split].append(submission_data)
|
319 |
+
|
320 |
+
# Update the appropriate DataFrame based on the split
|
321 |
+
if split == 'test':
|
322 |
+
df_to_update = df_synthesized_full
|
323 |
+
elif split == 'test-0.1':
|
324 |
+
df_to_update = df_synthesized_10
|
325 |
+
else: # human_generated_eval
|
326 |
+
df_to_update = df_human_generated
|
327 |
+
|
328 |
+
# Add row to DataFrame
|
329 |
+
new_row = {
|
330 |
+
'Method': submission_data['Method Name'],
|
331 |
+
f'STARK-{submission_data["Dataset"].upper()}_Hit@1': submission_data['results']['hit@1'],
|
332 |
+
f'STARK-{submission_data["Dataset"].upper()}_Hit@5': submission_data['results']['hit@5'],
|
333 |
+
f'STARK-{submission_data["Dataset"].upper()}_R@20': submission_data['results']['recall@20'],
|
334 |
+
f'STARK-{submission_data["Dataset"].upper()}_MRR': submission_data['results']['mrr']
|
335 |
+
}
|
336 |
+
|
337 |
+
# Update existing row or add new one
|
338 |
+
method_mask = df_to_update['Method'] == submission_data['Method Name']
|
339 |
+
if method_mask.any():
|
340 |
+
for col in new_row:
|
341 |
+
df_to_update.loc[method_mask, col] = new_row[col]
|
342 |
+
else:
|
343 |
+
df_to_update.loc[len(df_to_update)] = new_row
|
344 |
+
|
345 |
print(f"Successfully added submission from {folder_name} to {split} leaderboard")
|
346 |
else:
|
347 |
print(f"Invalid split '{split}' found in {folder_name}")
|