Spaces:
Running
Running
Download scripts/52_update_version_release.py from juhaha1230/AI_Menu_Search: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/spaces/juhaha1230/AI_Menu_Search/resolve/main/scripts/52_update_version_release.py
- Command line
-
hf download hf://spaces/juhaha1230/AI_Menu_Search/scripts/52_update_version_release.py
-
curl -L -o 52_update_version_release.py https://huggingface.co/spaces/juhaha1230/AI_Menu_Search/resolve/main/scripts/52_update_version_release.py
2.33 kB
| """Run the repeatable unreviewed PoC update pipeline for versioned menu DBs.""" | |
| from __future__ import annotations | |
| import argparse | |
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| SCRIPT_DIR = Path(__file__).resolve().parent | |
| def _run(script: str, *arguments: str) -> None: | |
| command = [sys.executable, str(SCRIPT_DIR / script), *arguments] | |
| print("\n>", " ".join(command), flush=True) | |
| subprocess.run(command, check=True) | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--db-dir", type=Path) | |
| parser.add_argument( | |
| "--versions", | |
| default="", | |
| help="comma-separated versions; default auto-discovers production DBs", | |
| ) | |
| parser.add_argument("--candidate-concurrency", type=int, default=5) | |
| parser.add_argument("--candidate-limit", type=int, default=0) | |
| parser.add_argument("--force-candidates", action="store_true") | |
| parser.add_argument( | |
| "--allow-external-llm", | |
| action="store_true", | |
| help="forward explicit approval for a non-Azure candidate backend", | |
| ) | |
| parser.add_argument("--skip-candidates", action="store_true") | |
| parser.add_argument("--skip-indexes", action="store_true") | |
| args = parser.parse_args() | |
| prepare_args = [] | |
| if args.db_dir: | |
| prepare_args.extend(["--db-dir", str(args.db_dir)]) | |
| if args.versions: | |
| prepare_args.extend(["--versions", args.versions]) | |
| _run("48_prepare_version_data.py", *prepare_args) | |
| if not args.skip_candidates: | |
| candidate_args = [ | |
| "--concurrency", | |
| str(max(1, args.candidate_concurrency)), | |
| ] | |
| if args.candidate_limit: | |
| candidate_args.extend(["--limit", str(args.candidate_limit)]) | |
| if args.force_candidates: | |
| candidate_args.append("--force") | |
| if args.allow_external_llm: | |
| candidate_args.append("--allow-external-llm") | |
| _run("51_generate_version_candidates.py", *candidate_args) | |
| _run("48_prepare_version_data.py", *prepare_args) | |
| _run("45_validate_eval_sets.py") | |
| if not args.skip_indexes: | |
| index_args = ["--versions", args.versions] if args.versions else [] | |
| _run("49_build_version_indexes.py", *index_args) | |
| print("\nVersion update pipeline completed.") | |
| if __name__ == "__main__": | |
| main() | |