Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,16 @@
|
|
| 1 |
import sys
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
if BACKEND_PATH not in sys.path:
|
| 7 |
sys.path.insert(0, BACKEND_PATH)
|
| 8 |
|
|
|
|
| 1 |
import sys
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
+
|
| 5 |
+
def _find_backend_path() -> Path:
|
| 6 |
+
current = Path(__file__).resolve().parent
|
| 7 |
+
for parent in [current] + list(current.parents):
|
| 8 |
+
candidate = parent / "backend"
|
| 9 |
+
if candidate.is_dir():
|
| 10 |
+
return candidate
|
| 11 |
+
raise RuntimeError("Could not find backend directory in parent paths")
|
| 12 |
+
|
| 13 |
+
BACKEND_PATH = str(_find_backend_path())
|
| 14 |
if BACKEND_PATH not in sys.path:
|
| 15 |
sys.path.insert(0, BACKEND_PATH)
|
| 16 |
|