Spaces:
Runtime error
Runtime error
DeltaZN commited on
Commit ·
17f0444
1
Parent(s): d696848
fix(hf): install runtime deps directly and add src to path for HF Space build
Browse filesHF's Gradio build runs pip install before copying the repo, so 'requirements.txt: -e .' failed (no pyproject.toml in /app). List runtime deps directly and put src/ on sys.path in app.py instead.
- app.py +9 -1
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,9 +1,17 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
import os
|
|
|
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
app = create_gradio_app(
|
| 9 |
config_path=Path(os.getenv("WORLD_SIMULATOR_CONFIG", "config/game.modal.local.json")),
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
import os
|
| 4 |
+
import sys
|
| 5 |
from pathlib import Path
|
| 6 |
|
| 7 |
+
# The project uses a src-layout. On Hugging Face Spaces the package is not
|
| 8 |
+
# pip-installed (requirements.txt lists runtime deps directly, because HF runs
|
| 9 |
+
# pip install before copying the repo into the build context), so make the
|
| 10 |
+
# src/ directory importable here. Harmless locally where the package is already
|
| 11 |
+
# installed in editable mode.
|
| 12 |
+
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
| 13 |
+
|
| 14 |
+
from world_simulator.api.gradio_app import create_gradio_app # noqa: E402
|
| 15 |
|
| 16 |
app = create_gradio_app(
|
| 17 |
config_path=Path(os.getenv("WORLD_SIMULATOR_CONFIG", "config/game.modal.local.json")),
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
|
|
|
|
|
|
| 1 |
+
gradio>=6.17.3
|
| 2 |
+
openai>=1.0
|