idolezal commited on
Commit
6c4fc74
ยท
1 Parent(s): c93b288

Compact vs. readable JSON

Browse files
Files changed (1) hide show
  1. server.py +2 -2
server.py CHANGED
@@ -124,7 +124,7 @@ class LeaderboardServer:
124
  data = json.load(f)
125
  data["metadata"] = metadata
126
  with open(file, "w") as f:
127
- json.dump(data, f)
128
 
129
  model_id = metadata["team_name"] + "_" + metadata["submission_id"]
130
  tournament_results = self.start_tournament(model_id, file)
@@ -145,7 +145,7 @@ class LeaderboardServer:
145
  # Temporary save tournament results
146
  tournament_results_path = os.path.join(self.local_leaderboard, "tournament.json")
147
  with open(tournament_results_path, "w") as f:
148
- json.dump(tournament_results, f)
149
 
150
  api.upload_file(
151
  path_or_fileobj=tournament_results_path,
 
124
  data = json.load(f)
125
  data["metadata"] = metadata
126
  with open(file, "w") as f:
127
+ json.dump(data, f, separators=(',', ':')) # compact JSON
128
 
129
  model_id = metadata["team_name"] + "_" + metadata["submission_id"]
130
  tournament_results = self.start_tournament(model_id, file)
 
145
  # Temporary save tournament results
146
  tournament_results_path = os.path.join(self.local_leaderboard, "tournament.json")
147
  with open(tournament_results_path, "w") as f:
148
+ json.dump(tournament_results, f, sort_keys=True, indent=2) # readable JSON
149
 
150
  api.upload_file(
151
  path_or_fileobj=tournament_results_path,