Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,7 +105,7 @@ def download_file(user_id, password, filename):
|
|
| 105 |
temp_name = f"{uuid.uuid4()}_{filename}"
|
| 106 |
temp_path = os.path.join(TMP_DIR, temp_name)
|
| 107 |
|
| 108 |
-
|
| 109 |
"wget",
|
| 110 |
"--tries=3",
|
| 111 |
"--no-check-certificate",
|
|
@@ -115,9 +115,9 @@ def download_file(user_id, password, filename):
|
|
| 115 |
]
|
| 116 |
|
| 117 |
if HF_TOKEN:
|
| 118 |
-
|
| 119 |
|
| 120 |
-
subprocess.run(
|
| 121 |
|
| 122 |
return f"{SPACE_URL}/file={temp_path}"
|
| 123 |
|
|
@@ -243,4 +243,5 @@ with gr.Blocks(title="Pockit Cloud Client") as app:
|
|
| 243 |
outputs=change_status
|
| 244 |
)
|
| 245 |
|
| 246 |
-
|
|
|
|
|
|
| 105 |
temp_name = f"{uuid.uuid4()}_{filename}"
|
| 106 |
temp_path = os.path.join(TMP_DIR, temp_name)
|
| 107 |
|
| 108 |
+
cmd = [
|
| 109 |
"wget",
|
| 110 |
"--tries=3",
|
| 111 |
"--no-check-certificate",
|
|
|
|
| 115 |
]
|
| 116 |
|
| 117 |
if HF_TOKEN:
|
| 118 |
+
cmd.insert(1, f"--header=Authorization: Bearer {HF_TOKEN}")
|
| 119 |
|
| 120 |
+
subprocess.run(cmd, check=True)
|
| 121 |
|
| 122 |
return f"{SPACE_URL}/file={temp_path}"
|
| 123 |
|
|
|
|
| 243 |
outputs=change_status
|
| 244 |
)
|
| 245 |
|
| 246 |
+
# IMPORTANT: allow tmp folder
|
| 247 |
+
app.launch(allowed_paths=[TMP_DIR])
|