elsamueldev commited on
Commit
21d4b07
·
1 Parent(s): a7219e0

fix: actualizar el script de inicialización para ejecutar main.py después de la descarga

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -4
  2. init.py +9 -1
Dockerfile CHANGED
@@ -17,8 +17,5 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
  # copy repo files
18
  COPY --chown=user . /app
19
 
20
- # run initialization script that downloads the code
21
- RUN python init.py
22
-
23
  # run the main script
24
- CMD ["python", "main.py"]
 
17
  # copy repo files
18
  COPY --chown=user . /app
19
 
 
 
 
20
  # run the main script
21
+ CMD ["python", "init.py"]
init.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
 
3
  from huggingface_hub import login, snapshot_download
4
 
@@ -15,4 +16,11 @@ snapshot_download(
15
  repo_type="dataset",
16
  local_dir=".",
17
  local_dir_use_symlinks=False
18
- )
 
 
 
 
 
 
 
 
1
  import os
2
+ import subprocess
3
 
4
  from huggingface_hub import login, snapshot_download
5
 
 
16
  repo_type="dataset",
17
  local_dir=".",
18
  local_dir_use_symlinks=False
19
+ )
20
+
21
+ local_dir = subprocess.run(["ls"], stdout=subprocess.PIPE).stdout.decode("utf-8")
22
+ print(local_dir)
23
+ if "main.py" not in local_dir:
24
+ raise RuntimeError("main.py not found in the downloaded dataset")
25
+
26
+ subprocess.run(["python", "main.py"])