File size: 2,044 Bytes
54152e6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/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())