Download launch.py from XiaoShengpeng/PV-PRISM: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/XiaoShengpeng/PV-PRISM/resolve/main/launch.py
- Command line
-
hf download hf://XiaoShengpeng/PV-PRISM/launch.py
-
curl -L -o launch.py https://huggingface.co/XiaoShengpeng/PV-PRISM/resolve/main/launch.py
1.02 kB
| """Select the registered local runtime, or the user's installed environment.""" | |
| import json | |
| import os | |
| from pathlib import Path | |
| import subprocess | |
| import sys | |
| def main(): | |
| root = Path(__file__).resolve().parent | |
| record = root / "provenance/local_runtime.json" | |
| registered = json.loads(record.read_text())["python"] if record.is_file() else None | |
| selected = os.environ.get("PV_PRISM_PYTHON") | |
| if not selected: | |
| selected = registered if registered and Path(registered).is_file() else sys.executable | |
| environment = dict(os.environ) | |
| environment.update(MKL_THREADING_LAYER="GNU", USE_TF="0", OPENBLAS_NUM_THREADS="1", OMP_NUM_THREADS="2", | |
| PYTHONDONTWRITEBYTECODE="1") | |
| arguments = sys.argv[1:] | |
| script = "verify.py" if arguments == ["--verify"] else "predict.py" | |
| if script == "verify.py": | |
| arguments = [] | |
| code = subprocess.call([selected, str(root / script), *arguments], env=environment) | |
| raise SystemExit(code) | |
| if __name__ == "__main__": | |
| main() | |