Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import requests
|
|
5 |
import traceback
|
6 |
import gradio as gr
|
7 |
|
8 |
-
# Node-related files
|
9 |
MAIN_FILES = {
|
10 |
'.env': """HF_API_TOKEN=YOUR_HF_API_TOKEN_HERE
|
11 |
NODE_ENV=production
|
@@ -222,10 +222,8 @@ def create_project_files():
|
|
222 |
for fname, content in MAIN_FILES.items():
|
223 |
fpath = os.path.join(base_dir, fname)
|
224 |
if not os.path.exists(fpath):
|
225 |
-
if fname == '.env':
|
226 |
-
|
227 |
-
if hf_api_token and "YOUR_HF_API_TOKEN_HERE" in content:
|
228 |
-
content = content.replace("YOUR_HF_API_TOKEN_HERE", hf_api_token)
|
229 |
with open(fpath, 'w', encoding='utf-8') as f:
|
230 |
f.write(content)
|
231 |
logs.append(f"Created file: {fpath}")
|
|
|
5 |
import traceback
|
6 |
import gradio as gr
|
7 |
|
8 |
+
# Node-related files stored directly in Python dictionaries
|
9 |
MAIN_FILES = {
|
10 |
'.env': """HF_API_TOKEN=YOUR_HF_API_TOKEN_HERE
|
11 |
NODE_ENV=production
|
|
|
222 |
for fname, content in MAIN_FILES.items():
|
223 |
fpath = os.path.join(base_dir, fname)
|
224 |
if not os.path.exists(fpath):
|
225 |
+
if fname == '.env' and hf_api_token:
|
226 |
+
content = content.replace("YOUR_HF_API_TOKEN_HERE", hf_api_token)
|
|
|
|
|
227 |
with open(fpath, 'w', encoding='utf-8') as f:
|
228 |
f.write(content)
|
229 |
logs.append(f"Created file: {fpath}")
|