loodvanniekerkginkgo commited on
Commit
b7382f6
·
1 Parent(s): df06d5c

Rather catching all exceptions

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -55,9 +55,9 @@ def get_leaderboard_object(assay: str | None = None):
55
  # Note(Lood): Would be nice to make it clear that the Search Column is searching on model name
56
  try:
57
  current_dataframe = pd.read_csv("debug-current-results.csv")
58
- except (pd.errors.EmptyDataError, pd.errors.ParserError):
59
  # Return empty dataframe as fallback
60
- print("Fallback: Returning empty dataframe as it doesn't exist yet")
61
  current_dataframe = pd.DataFrame(columns=LEADERBOARD_COLUMNS_RENAME.values())
62
  lb = Leaderboard(
63
  value=format_leaderboard_table(df_results=current_dataframe, assay=assay),
@@ -77,9 +77,9 @@ def refresh_overall_leaderboard():
77
  # Handle race condition where file is being written while we read it
78
  try:
79
  current_dataframe = pd.read_csv("debug-current-results.csv")
80
- except (pd.errors.EmptyDataError, pd.errors.ParserError):
81
  # Return empty dataframe with required columns as fallback
82
- print("Fallback: Returning empty dataframe as it doesn't exist yet")
83
  current_dataframe = pd.DataFrame(columns=LEADERBOARD_COLUMNS_RENAME.values())
84
  return format_leaderboard_table(df_results=current_dataframe)
85
 
 
55
  # Note(Lood): Would be nice to make it clear that the Search Column is searching on model name
56
  try:
57
  current_dataframe = pd.read_csv("debug-current-results.csv")
58
+ except Exception as e:
59
  # Return empty dataframe as fallback
60
+ print(f"Fallback: Returning empty dataframe as it doesn't exist yet: {e}")
61
  current_dataframe = pd.DataFrame(columns=LEADERBOARD_COLUMNS_RENAME.values())
62
  lb = Leaderboard(
63
  value=format_leaderboard_table(df_results=current_dataframe, assay=assay),
 
77
  # Handle race condition where file is being written while we read it
78
  try:
79
  current_dataframe = pd.read_csv("debug-current-results.csv")
80
+ except Exception as e:
81
  # Return empty dataframe with required columns as fallback
82
+ print(f"Fallback: Returning empty dataframe as it doesn't exist yet: {e}")
83
  current_dataframe = pd.DataFrame(columns=LEADERBOARD_COLUMNS_RENAME.values())
84
  return format_leaderboard_table(df_results=current_dataframe)
85