Spaces:
Sleeping
Sleeping
ใ
ใ
ใ
commited on
Commit ยท
a8e23f9
1
Parent(s): b4ed91b
fix: add allowed_paths to app.launch() for SVG file access
Browse files- CodeWeaver/ui/app.py +9 -0
CodeWeaver/ui/app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import sys
|
| 2 |
import logging
|
|
|
|
| 3 |
from pathlib import Path
|
| 4 |
import uuid
|
| 5 |
|
|
@@ -373,11 +374,19 @@ app = create_demo()
|
|
| 373 |
|
| 374 |
|
| 375 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
app.launch(
|
| 377 |
server_name="0.0.0.0",
|
| 378 |
server_port=7860,
|
| 379 |
share=False,
|
| 380 |
theme=gr.themes.Soft(),
|
|
|
|
|
|
|
| 381 |
server_kwargs={
|
| 382 |
"timeout_keep_alive": 600, # ์ ํด ์ฐ๊ฒฐ ์ ์ง ์๊ฐ 600์ด(10๋ถ)
|
| 383 |
}
|
|
|
|
| 1 |
import sys
|
| 2 |
import logging
|
| 3 |
+
import os
|
| 4 |
from pathlib import Path
|
| 5 |
import uuid
|
| 6 |
|
|
|
|
| 374 |
|
| 375 |
|
| 376 |
if __name__ == "__main__":
|
| 377 |
+
# ํ์ฌ ์คํ ๊ฒฝ๋ก(ํ๋ก์ ํธ ๋ฃจํธ)๋ฅผ ์ ๋ ๊ฒฝ๋ก๋ก ๊ฐ์ ธ์ด
|
| 378 |
+
current_dir = os.path.dirname(os.path.abspath(__file__)) # ui ํด๋
|
| 379 |
+
root_dir = os.path.dirname(current_dir) # CodeWeaver ๋ฃจํธ ํด๋
|
| 380 |
+
# Hugging Face Space์์๋ ์ ์ฅ์ ๋ฃจํธ๋ ํ์ฉ
|
| 381 |
+
repo_root = os.path.dirname(root_dir) # hf-space2 ๋ฃจํธ
|
| 382 |
+
|
| 383 |
app.launch(
|
| 384 |
server_name="0.0.0.0",
|
| 385 |
server_port=7860,
|
| 386 |
share=False,
|
| 387 |
theme=gr.themes.Soft(),
|
| 388 |
+
# ๐ [ํต์ฌ ํด๊ฒฐ์ฑ
] ๋ฃจํธ ๋๋ ํ ๋ฆฌ์ ํ์ผ ์ ๊ทผ์ ํ์ฉํฉ๋๋ค.
|
| 389 |
+
allowed_paths=[root_dir, repo_root, "."],
|
| 390 |
server_kwargs={
|
| 391 |
"timeout_keep_alive": 600, # ์ ํด ์ฐ๊ฒฐ ์ ์ง ์๊ฐ 600์ด(10๋ถ)
|
| 392 |
}
|