Revert elo file sorting

#35
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -52,21 +52,11 @@ if __name__ == "__main__":
52
  logger.info(f"args: {args}")
53
 
54
  elo_result_files = glob.glob("elo_results_*.pkl")
55
- def extract_sort_key(filename):
56
- match = re.search(r'(\d{8})-(\d+)', filename)
57
- if match:
58
- # Extract the date and identifier parts, converting them to integers for sorting
59
- date_part = int(match.group(1))
60
- id_part = int(match.group(2))
61
- return (date_part, id_part)
62
- else:
63
- # Fallback sort key if the filename does not match the expected format
64
- return (0, 0)
65
- elo_result_files.sort(key=lambda x: extract_sort_key(x[12:-4]))
66
  elo_result_file = elo_result_files[-1]
67
 
68
  leaderboard_table_files = glob.glob("leaderboard_table_*.csv")
69
- leaderboard_table_files.sort(key=lambda x: extract_sort_key(x[18:-4]))
70
  leaderboard_table_file = leaderboard_table_files[-1]
71
 
72
  demo = build_demo(elo_result_file, leaderboard_table_file)
 
52
  logger.info(f"args: {args}")
53
 
54
  elo_result_files = glob.glob("elo_results_*.pkl")
55
+ elo_result_files.sort(key=lambda x: int(x[12:-4]))
 
 
 
 
 
 
 
 
 
 
56
  elo_result_file = elo_result_files[-1]
57
 
58
  leaderboard_table_files = glob.glob("leaderboard_table_*.csv")
59
+ leaderboard_table_files.sort(key=lambda x: int(x[18:-4]))
60
  leaderboard_table_file = leaderboard_table_files[-1]
61
 
62
  demo = build_demo(elo_result_file, leaderboard_table_file)