Spaces:
Runtime error
Runtime error
use SPACE_ID
Browse files
app.py
CHANGED
|
@@ -20,8 +20,8 @@ NUM_TRENDING_DATASETS = 10
|
|
| 20 |
NUM_USER_DATASETS = 10
|
| 21 |
SESSIONS_DIR = "s"
|
| 22 |
SESSION_DIR_SPACES_SYMLINK = os.path.join("/data", SESSIONS_DIR)
|
| 23 |
-
|
| 24 |
-
URL = f"https://huggingface.co/spaces/{
|
| 25 |
css = """
|
| 26 |
.transparent-dropdown, .transparent-dropdown .container .wrap, .transparent-accordion {
|
| 27 |
background: var(--body-background-fill);
|
|
@@ -188,7 +188,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 188 |
|
| 189 |
|
| 190 |
if __name__ == "__main__":
|
| 191 |
-
if
|
| 192 |
os.makedirs(SESSION_DIR_SPACES_SYMLINK, exist_ok=True)
|
| 193 |
try:
|
| 194 |
os.symlink(SESSION_DIR_SPACES_SYMLINK, SESSIONS_DIR, target_is_directory=True)
|
|
|
|
| 20 |
NUM_USER_DATASETS = 10
|
| 21 |
SESSIONS_DIR = "s"
|
| 22 |
SESSION_DIR_SPACES_SYMLINK = os.path.join("/data", SESSIONS_DIR)
|
| 23 |
+
SPACE_ID = os.getenv("SPACE_ID")
|
| 24 |
+
URL = f"https://huggingface.co/spaces/{SPACE_ID}" if SPACE_ID else "http://127.0.0.1:7870"
|
| 25 |
css = """
|
| 26 |
.transparent-dropdown, .transparent-dropdown .container .wrap, .transparent-accordion {
|
| 27 |
background: var(--body-background-fill);
|
|
|
|
| 188 |
|
| 189 |
|
| 190 |
if __name__ == "__main__":
|
| 191 |
+
if SPACE_ID:
|
| 192 |
os.makedirs(SESSION_DIR_SPACES_SYMLINK, exist_ok=True)
|
| 193 |
try:
|
| 194 |
os.symlink(SESSION_DIR_SPACES_SYMLINK, SESSIONS_DIR, target_is_directory=True)
|