Spaces:
Running
on
Zero
Running
on
Zero
packages
Browse files- loader.py +5 -2
- requirements.txt +0 -1
loader.py
CHANGED
@@ -2,7 +2,7 @@ import os
|
|
2 |
import sys
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
import traceback
|
5 |
-
|
6 |
def load_script(file_str: str):
|
7 |
"""
|
8 |
Downloads a file from the Hugging Face Hub and ensures a symlink exists in the current directory.
|
@@ -102,6 +102,9 @@ def load_scripts():
|
|
102 |
3. Read each line from the downloaded file list, where each line specifies another file to download.
|
103 |
4. After downloading all files, execute the last downloaded file.
|
104 |
"""
|
|
|
|
|
|
|
105 |
file_list = os.getenv("FILE_LIST", "").strip()
|
106 |
if not file_list:
|
107 |
print("No 'FILE_LIST' environment variable set. Nothing to download.")
|
@@ -133,7 +136,7 @@ def load_scripts():
|
|
133 |
downloaded_files.append(file_path)
|
134 |
|
135 |
# Step 4: Execute the last downloaded file
|
136 |
-
if downloaded_files:
|
137 |
last_file_path = downloaded_files[-1]
|
138 |
print(f"Executing the last downloaded script: '{last_file_path}'")
|
139 |
try:
|
|
|
2 |
import sys
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
import traceback
|
5 |
+
import json
|
6 |
def load_script(file_str: str):
|
7 |
"""
|
8 |
Downloads a file from the Hugging Face Hub and ensures a symlink exists in the current directory.
|
|
|
102 |
3. Read each line from the downloaded file list, where each line specifies another file to download.
|
103 |
4. After downloading all files, execute the last downloaded file.
|
104 |
"""
|
105 |
+
local_config = {}
|
106 |
+
if os.path.exists("local.json"):
|
107 |
+
local_config = json.load(open("local.json"))
|
108 |
file_list = os.getenv("FILE_LIST", "").strip()
|
109 |
if not file_list:
|
110 |
print("No 'FILE_LIST' environment variable set. Nothing to download.")
|
|
|
136 |
downloaded_files.append(file_path)
|
137 |
|
138 |
# Step 4: Execute the last downloaded file
|
139 |
+
if downloaded_files and local_config.get("execute_last_script", True):
|
140 |
last_file_path = downloaded_files[-1]
|
141 |
print(f"Executing the last downloaded script: '{last_file_path}'")
|
142 |
try:
|
requirements.txt
CHANGED
@@ -4,7 +4,6 @@ transformers
|
|
4 |
accelerate
|
5 |
safetensors
|
6 |
einops
|
7 |
-
onnxruntime-gpu
|
8 |
spaces==0.19.4
|
9 |
opencv-python
|
10 |
pyjwt
|
|
|
4 |
accelerate
|
5 |
safetensors
|
6 |
einops
|
|
|
7 |
spaces==0.19.4
|
8 |
opencv-python
|
9 |
pyjwt
|