Anurag137 commited on
Commit
7e43503
·
1 Parent(s): 8be4b73

fix: smart path detection for local and HF layouts

Browse files
Files changed (1) hide show
  1. 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 (HF Space: all files in WORKDIR) --------
29
- _ROOT = Path(__file__).resolve().parent.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