#!/usr/bin/env python3 """Exercise the portable package with the frozen VAL-07 typography prompt.""" from __future__ import annotations import argparse from pathlib import Path import subprocess import sys RELEASE_ROOT = Path(__file__).resolve().parent RUNNER = RELEASE_ROOT / "generate.py" VALIDATOR = RELEASE_ROOT / "validate_release.py" PROMPT = ( 'Minimal travel postcard with the exact large text "ARCTIC LOOP" and ' 'the exact small text "NORTHERN COAST"; an ivory lighthouse on a ' "slate-blue cliff below the lettering, crisp vector print." ) NEGATIVE_PROMPT = ( "lowres, blurry, jpeg artifacts, watermark, signature, logo, unreadable " "text, misspelled text, duplicate subject, deformed anatomy, extra " "fingers, missing fingers, cropped hands" ) def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--cpu-self-check", action="store_true") parser.add_argument("--model", default=str(RELEASE_ROOT)) parser.add_argument("--output-dir", type=Path) return parser.parse_args() def main() -> int: args = parse_args() subprocess.run([sys.executable, str(VALIDATOR)], check=True) if args.cpu_self_check: return 0 if args.output_dir is None: raise SystemExit("--output-dir is required unless --cpu-self-check is used") output_dir = args.output_dir.resolve() output_path = output_dir / "VAL-07_portable_combined.png" command = [ sys.executable, str(RUNNER), "--model", args.model, "--prompt", PROMPT, "--negative-prompt", NEGATIVE_PROMPT, "--output", str(output_path), "--height", "512", "--width", "512", "--steps", "20", "--cfg", "5.0", "--seed", "27182819", "--static-shift", "6.0", ] return subprocess.run(command, check=False).returncode if __name__ == "__main__": raise SystemExit(main())