Spaces:
Runtime error
Runtime error
Commit
·
6d85f4d
1
Parent(s):
e3df626
chore: write env file
Browse files- substra_launcher.py +6 -12
substra_launcher.py
CHANGED
|
@@ -7,6 +7,12 @@ async def launch_substra_space(
|
|
| 7 |
) -> RepoUrl:
|
| 8 |
repo_id = "owkin/trainer-" + repo_id
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
repo_url = hf_api.create_repo(
|
| 11 |
repo_id=repo_id,
|
| 12 |
repo_type="space",
|
|
@@ -19,16 +25,4 @@ async def launch_substra_space(
|
|
| 19 |
folder_path="./substra_template/"
|
| 20 |
)
|
| 21 |
|
| 22 |
-
ENV_FILE = f"""\
|
| 23 |
-
SUBSTRA_ORG1_DISTR={hospital_a / 100}
|
| 24 |
-
SUBSTRA_ORG2_DISTR={hospital_b / 100}\
|
| 25 |
-
"""
|
| 26 |
-
|
| 27 |
-
hf_api.upload_file(
|
| 28 |
-
repo_id=repo_id,
|
| 29 |
-
path_or_fileobj=DOCKER_FILE.encode(),
|
| 30 |
-
path_in_repo=".env",
|
| 31 |
-
repo_type="space",
|
| 32 |
-
)
|
| 33 |
-
|
| 34 |
return repo_url
|
|
|
|
| 7 |
) -> RepoUrl:
|
| 8 |
repo_id = "owkin/trainer-" + repo_id
|
| 9 |
|
| 10 |
+
|
| 11 |
+
ENV_FILE = f"SUBSTRA_ORG1_DISTR={hospital_a / 100} \nSUBSTRA_ORG2_DISTR={hospital_b / 100}"
|
| 12 |
+
|
| 13 |
+
with open("substra_template/.env", 'w') as f:
|
| 14 |
+
f.write(ENV_FILE)
|
| 15 |
+
|
| 16 |
repo_url = hf_api.create_repo(
|
| 17 |
repo_id=repo_id,
|
| 18 |
repo_type="space",
|
|
|
|
| 25 |
folder_path="./substra_template/"
|
| 26 |
)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
return repo_url
|