in competitions/cli/submit.py [0:0]
def run(self):
if os.path.isfile(self.args.submission):
files = {"submission_file": open(self.args.submission, "rb")}
data = {
"hub_model": "None",
"submission_comment": self.args.comment,
}
else:
files = {"submission_file": None}
data = {
"hub_model": self.args.submission,
"submission_comment": self.args.comment,
}
headers = {"Authorization": f"Bearer {self.args.token}"}
api_url = "https://" + self.args.competition_id.replace("/", "-") + ".hf.space/new_submission"
response = requests.post(api_url, data=data, files=files, headers=headers)
print(response.json())