Spaces:
Runtime error
Runtime error
| from huggingface_hub import HfApi, RepoUrl | |
| def launch_substra_space(hf_api: HfApi, num_hospitals: int, repo_id: str) -> RepoUrl: | |
| repo_id = "NimaBoscarino/" + repo_id | |
| repo_url = hf_api.create_repo( | |
| repo_id=repo_id, | |
| repo_type="space", | |
| space_sdk="docker", | |
| ) | |
| hf_api.upload_folder( | |
| repo_id=repo_id, | |
| repo_type="space", | |
| folder_path="substra_template/" | |
| ) | |
| ENV_FILE = f"""\ | |
| SUBSTRA_NUM_HOSPITALS={num_hospitals} | |
| """ | |
| hf_api.upload_file( | |
| repo_id=repo_id, | |
| path_or_fileobj=ENV_FILE.encode(), | |
| path_in_repo=".env", | |
| repo_type="space", | |
| ) | |
| return repo_url | |