Spaces:
Runtime error
Runtime error
[fix] fix utils.teamFileApi._create_team
Browse files- competitions/utils.py +15 -0
competitions/utils.py
CHANGED
|
@@ -503,6 +503,21 @@ class TeamFileApi:
|
|
| 503 |
repo_id=self.competition_id,
|
| 504 |
repo_type="dataset",
|
| 505 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
return team_id
|
| 507 |
|
| 508 |
def create_team(self, user_token: str, team_name: str, other_data: Dict[str, Any]) -> str:
|
|
|
|
| 503 |
repo_id=self.competition_id,
|
| 504 |
repo_type="dataset",
|
| 505 |
)
|
| 506 |
+
|
| 507 |
+
team_submission_info = {}
|
| 508 |
+
team_submission_info["id"] = team_id
|
| 509 |
+
team_submission_info["submissions"] = []
|
| 510 |
+
team_submission_info_json = json.dumps(team_submission_info, indent=4)
|
| 511 |
+
team_submission_info_json_bytes = team_submission_info_json.encode("utf-8")
|
| 512 |
+
team_submission_info_json_buffer = io.BytesIO(team_submission_info_json_bytes)
|
| 513 |
+
|
| 514 |
+
api.upload_file(
|
| 515 |
+
path_or_fileobj=team_submission_info_json_buffer,
|
| 516 |
+
path_in_repo=f"submission_info/{team_id}.json",
|
| 517 |
+
repo_id=self.competition_id,
|
| 518 |
+
repo_type="dataset",
|
| 519 |
+
)
|
| 520 |
+
|
| 521 |
return team_id
|
| 522 |
|
| 523 |
def create_team(self, user_token: str, team_name: str, other_data: Dict[str, Any]) -> str:
|