kexinhuang12345 commited on
Commit
59ceb6d
·
1 Parent(s): 139368d
Files changed (1) hide show
  1. src/populate.py +9 -1
src/populate.py CHANGED
@@ -51,7 +51,15 @@ def get_leaderboard_df(EVAL_REQUESTS_PATH, tasks) -> pd.DataFrame:
51
  model.update({name2short_name[i]: str(model['test'][i][0])[:4] + '±' + str(model['test'][i][1])[:4] if i in model['test'] else '-' for i in name2short_name})
52
 
53
  columns_to_show = ['model', 'author', 'email', 'paper_url', 'github_url', 'submitted_time', 'params'] + list(name2short_name.values())
54
- df_res = pd.DataFrame([{col: model[col] for col in columns_to_show} for model in model_res])
 
 
 
 
 
 
 
 
55
  print(df_res)
56
  ranks = df_res[list(name2short_name.values())].rank()
57
  df_res.rename(columns={'model': 'Model', 'author': 'Author', 'email': 'Email', 'paper_url': 'Paper URL', 'github_url': 'Github URL', 'submitted_time': 'Time', 'params': '# of Params'}, inplace=True)
 
51
  model.update({name2short_name[i]: str(model['test'][i][0])[:4] + '±' + str(model['test'][i][1])[:4] if i in model['test'] else '-' for i in name2short_name})
52
 
53
  columns_to_show = ['model', 'author', 'email', 'paper_url', 'github_url', 'submitted_time', 'params'] + list(name2short_name.values())
54
+
55
+ # Check if model_res is empty
56
+ if len(model_res) > 0:
57
+ df_res = pd.DataFrame([{col: model[col] for col in columns_to_show} for model in model_res])
58
+ else:
59
+ # Initialize an empty DataFrame with the desired columns
60
+ df_res = pd.DataFrame(columns=columns_to_show)
61
+
62
+ #df_res = pd.DataFrame([{col: model[col] for col in columns_to_show} for model in model_res])
63
  print(df_res)
64
  ranks = df_res[list(name2short_name.values())].rank()
65
  df_res.rename(columns={'model': 'Model', 'author': 'Author', 'email': 'Email', 'paper_url': 'Paper URL', 'github_url': 'Github URL', 'submitted_time': 'Time', 'params': '# of Params'}, inplace=True)