Spaces:
Runtime error
Runtime error
| <<<<<<< HEAD | |
| """Bootstrap Unreal's embedded Python with the shared Synesthesia environment.""" | |
| from __future__ import annotations | |
| import glob | |
| import pathlib | |
| import platform | |
| import sys | |
| def _log(message: str) -> None: | |
| prefix = "[Synesthesia Unreal Python]" | |
| try: | |
| import unreal # type: ignore | |
| unreal.log(f"{prefix} {message}") | |
| except Exception: | |
| print(f"{prefix} {message}") | |
| def _project_root() -> pathlib.Path: | |
| script_path = pathlib.Path(__file__).resolve() | |
| return script_path.parents[2] | |
| def _candidate_site_packages(venv_root: pathlib.Path) -> list[pathlib.Path]: | |
| if platform.system() == "Windows": | |
| return [venv_root / "Lib" / "site-packages"] | |
| candidates = [venv_root / "lib" / "python3.12" / "site-packages"] | |
| for path in sorted(glob.glob(str(venv_root / "lib" / "python3*" / "site-packages"))): | |
| candidates.append(pathlib.Path(path)) | |
| return candidates | |
| def _append_path(path: pathlib.Path) -> None: | |
| resolved = str(path.resolve()) | |
| if resolved not in sys.path: | |
| sys.path.append(resolved) | |
| _log(f"Added to sys.path: {resolved}") | |
| def bootstrap() -> None: | |
| root = _project_root() | |
| venv_root = root / ".venv" | |
| if not venv_root.exists(): | |
| _log(f"Root .venv not found at {venv_root}") | |
| return | |
| site_packages = next((path for path in _candidate_site_packages(venv_root) if path.exists()), None) | |
| if site_packages is None: | |
| _log(f"No site-packages directory found under {venv_root}") | |
| return | |
| _append_path(site_packages) | |
| ml_pipeline = root / "ML_Pipeline" | |
| if ml_pipeline.exists(): | |
| _append_path(ml_pipeline) | |
| bootstrap() | |
| ======= | |
| import unreal | |
| def init(): | |
| unreal.log("Synesthesia initialized.") | |
| # Initialize subsystems, paths, etc. | |
| if __name__ == "__main__": | |
| init() | |
| >>>>>>> ws1-rocm-model-export-pipeline-6323038014816139641 | |