Spaces:
Runtime error
Runtime error
from huggingface_hub import HfApi, RepoUrl | |
async def launch_substra_space( | |
hf_api: HfApi, repo_id: str, | |
hospital_a: int, hospital_b: int, | |
) -> RepoUrl: | |
repo_id = "owkin/trainer-" + repo_id | |
ENV_FILE = f"SUBSTRA_ORG1_DISTR={hospital_a / 100} \nSUBSTRA_ORG2_DISTR={hospital_b / 100}" | |
with open("substra_template/.env", 'w') as f: | |
f.write(ENV_FILE) | |
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/" | |
) | |
return repo_url | |