zhiminy commited on
Commit
9a5f3b6
·
1 Parent(s): 2e18462
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -26,6 +26,7 @@ load_dotenv()
26
 
27
  AGENTS_REPO = "SWE-Arena/bot_metadata" # HuggingFace dataset for agent metadata
28
  ISSUE_METADATA_REPO = "SWE-Arena/issue_metadata" # HuggingFace dataset for issue metadata
 
29
  LEADERBOARD_TIME_FRAME_DAYS = 180 # Time frame for leaderboard
30
  UPDATE_TIME_FRAME_DAYS = 30 # How often to re-mine data via BigQuery
31
 
@@ -950,7 +951,7 @@ def get_hf_token():
950
 
951
  def load_cached_leaderboard_and_metrics():
952
  """
953
- Load cached leaderboard and monthly metrics data from SWE-Arena/leaderboard_metadata dataset.
954
  This is much faster than constructing from scratch on every app launch.
955
 
956
  Returns:
@@ -968,7 +969,7 @@ def load_cached_leaderboard_and_metrics():
968
 
969
  # Download cached file
970
  cached_path = hf_hub_download(
971
- repo_id="SWE-Arena/leaderboard_metadata",
972
  filename="swe-issue.json",
973
  repo_type="dataset",
974
  token=token
@@ -1079,7 +1080,6 @@ def save_agent_to_hf(data):
1079
 
1080
  def save_leaderboard_and_metrics_to_hf():
1081
  """
1082
- Save leaderboard data and monthly metrics to SWE-Arena/leaderboard_metadata dataset.
1083
  Creates a comprehensive JSON file with both leaderboard stats and monthly metrics.
1084
  If the file exists, it will be overwritten.
1085
 
@@ -1127,11 +1127,11 @@ def save_leaderboard_and_metrics_to_hf():
1127
  file_like_object = io.BytesIO(json_content.encode('utf-8'))
1128
 
1129
  # Upload to HuggingFace (will overwrite if exists)
1130
- print(f"\n🤗 Uploading to SWE-Arena/leaderboard_metadata...")
1131
  api.upload_file(
1132
  path_or_fileobj=file_like_object,
1133
  path_in_repo="swe-issue.json",
1134
- repo_id="SWE-Arena/leaderboard_metadata",
1135
  repo_type="dataset",
1136
  token=token,
1137
  commit_message=f"Update leaderboard data - {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S')} UTC"
@@ -1249,7 +1249,7 @@ def mine_all_agents():
1249
  # After mining is complete, save leaderboard and metrics to HuggingFace
1250
  print(f"📤 Uploading leaderboard and metrics data...")
1251
  if save_leaderboard_and_metrics_to_hf():
1252
- print(f"✓ Leaderboard and metrics successfully uploaded to SWE-Arena/leaderboard_metadata")
1253
  else:
1254
  print(f"⚠️ Failed to upload leaderboard and metrics data")
1255
 
 
26
 
27
  AGENTS_REPO = "SWE-Arena/bot_metadata" # HuggingFace dataset for agent metadata
28
  ISSUE_METADATA_REPO = "SWE-Arena/issue_metadata" # HuggingFace dataset for issue metadata
29
+ LEADERBOARD_REPO = "SWE-Arena/leaderboard_metadata" # HuggingFace dataset for leaderboard metadata
30
  LEADERBOARD_TIME_FRAME_DAYS = 180 # Time frame for leaderboard
31
  UPDATE_TIME_FRAME_DAYS = 30 # How often to re-mine data via BigQuery
32
 
 
951
 
952
  def load_cached_leaderboard_and_metrics():
953
  """
954
+ Load cached leaderboard and monthly metrics data from HuggingFace.
955
  This is much faster than constructing from scratch on every app launch.
956
 
957
  Returns:
 
969
 
970
  # Download cached file
971
  cached_path = hf_hub_download(
972
+ repo_id=LEADERBOARD_REPO,
973
  filename="swe-issue.json",
974
  repo_type="dataset",
975
  token=token
 
1080
 
1081
  def save_leaderboard_and_metrics_to_hf():
1082
  """
 
1083
  Creates a comprehensive JSON file with both leaderboard stats and monthly metrics.
1084
  If the file exists, it will be overwritten.
1085
 
 
1127
  file_like_object = io.BytesIO(json_content.encode('utf-8'))
1128
 
1129
  # Upload to HuggingFace (will overwrite if exists)
1130
+ print(f"\n🤗 Uploading to {LEADERBOARD_REPO}...")
1131
  api.upload_file(
1132
  path_or_fileobj=file_like_object,
1133
  path_in_repo="swe-issue.json",
1134
+ repo_id=LEADERBOARD_REPO,
1135
  repo_type="dataset",
1136
  token=token,
1137
  commit_message=f"Update leaderboard data - {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S')} UTC"
 
1249
  # After mining is complete, save leaderboard and metrics to HuggingFace
1250
  print(f"📤 Uploading leaderboard and metrics data...")
1251
  if save_leaderboard_and_metrics_to_hf():
1252
+ print(f"✓ Leaderboard and metrics successfully uploaded to {LEADERBOARD_REPO}")
1253
  else:
1254
  print(f"⚠️ Failed to upload leaderboard and metrics data")
1255