Spaces:
Runtime error
Runtime error
File size: 663 Bytes
04a30fc 73834eb 04a30fc 73834eb 04a30fc 73834eb 04a30fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
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
|