Spaces:
Running
Running
fix: smart path detection for local and HF layouts
Browse files- environment.py +5 -2
environment.py
CHANGED
|
@@ -25,8 +25,11 @@ from collections import deque
|
|
| 25 |
from pathlib import Path
|
| 26 |
from typing import Any, Callable, Optional
|
| 27 |
|
| 28 |
-
# -- Ensure project root is importable (
|
| 29 |
-
_ROOT = Path(__file__).resolve().parent
|
|
|
|
|
|
|
|
|
|
| 30 |
if str(_ROOT) not in sys.path:
|
| 31 |
sys.path.insert(0, str(_ROOT))
|
| 32 |
|
|
|
|
| 25 |
from pathlib import Path
|
| 26 |
from typing import Any, Callable, Optional
|
| 27 |
|
| 28 |
+
# -- Ensure project root is importable (Handles both Local and HF layouts) ---
|
| 29 |
+
_ROOT = Path(__file__).resolve().parent
|
| 30 |
+
if _ROOT.name == "server":
|
| 31 |
+
_ROOT = _ROOT.parent
|
| 32 |
+
|
| 33 |
if str(_ROOT) not in sys.path:
|
| 34 |
sys.path.insert(0, str(_ROOT))
|
| 35 |
|