| from __future__ import annotations |
|
|
| import importlib.util |
| import os |
| from pathlib import Path |
|
|
|
|
| _SERVER_PATH = Path(__file__).resolve().parent / "app" / "app.py" |
| _SPEC = importlib.util.spec_from_file_location("agent_parkour_server", _SERVER_PATH) |
| if _SPEC is None or _SPEC.loader is None: |
| raise RuntimeError(f"unable to load app server from {_SERVER_PATH}") |
| _MODULE = importlib.util.module_from_spec(_SPEC) |
| _SPEC.loader.exec_module(_MODULE) |
|
|
| app = _MODULE.app |
|
|
|
|
| if __name__ == "__main__": |
| port = int(os.environ.get("PORT", "7860")) |
| app.launch(server_port=port, show_error=True) |
|
|