Libra-1995 commited on
Commit
d39f16b
·
1 Parent(s): 560ccce

update code

Browse files
Files changed (1) hide show
  1. web_server.py +7 -1
web_server.py CHANGED
@@ -307,7 +307,7 @@ def get_current_state_endpoint(env_handler: EnvHandler = Depends(_get_env_handle
307
  Get the current state of the environment.
308
  """
309
  state = env_handler.get_current_state()
310
- return Response(content=pickle.dumps(state), media_type="application/octet-stream")
311
 
312
 
313
  @app.post("/execute_action")
@@ -342,6 +342,12 @@ def execute_action_endpoint(
342
  env_manager.get_env_handler(token_info["submission_id"]).close()
343
  delete_client_space(token_info["client_space_id"])
344
  update_submission_status(token_info["team_id"], token_info["submission_id"], SubmissionStatus.SUCCESS.value)
 
 
 
 
 
 
345
  result = pickle.dumps({"done": done, "state": None})
346
  _result_dict.push(transaction_id, result)
347
  return Response(content=result, media_type="application/octet-stream")
 
307
  Get the current state of the environment.
308
  """
309
  state = env_handler.get_current_state()
310
+ return Response(content=pickle.dumps({"done": env_handler.has_done, "state": state}), media_type="application/octet-stream")
311
 
312
 
313
  @app.post("/execute_action")
 
342
  env_manager.get_env_handler(token_info["submission_id"]).close()
343
  delete_client_space(token_info["client_space_id"])
344
  update_submission_status(token_info["team_id"], token_info["submission_id"], SubmissionStatus.SUCCESS.value)
345
+ hf_api.upload_folder(
346
+ repo_id=COMPETITION_ID,
347
+ folder_path=env_handler.output,
348
+ repo_type="dataset",
349
+ path_in_repo=f"eval_results/{token_info["submission_id"]}",
350
+ )
351
  result = pickle.dumps({"done": done, "state": None})
352
  _result_dict.push(transaction_id, result)
353
  return Response(content=result, media_type="application/octet-stream")