"""A/B: does a typed fragment meaningfully steer the output? Runs the same images twice — once with no fragment, once with a raw personal line — and prints both interpretations + film titles so we can see whether the words lead (task #16) rather than just tint. .venv/bin/python -m scripts.ab_fragment [model] """ import os import sys from dotenv import load_dotenv load_dotenv() if len(sys.argv) > 1: os.environ["CHALCHITRA_MODEL"] = sys.argv[1] from backend import interpret # noqa: E402 from scripts.smoke_test import moody_jpeg # noqa: E402 # Ambiguous-ish frames: warm dusk + a quiet interior. On their own they read as # soft nostalgia; the fragment should pull them somewhere specific. IMAGES = [ moody_jpeg((30, 28, 36), (120, 86, 60), blob=(255, 190, 110, 70)), moody_jpeg((18, 18, 22), (60, 55, 64)), ] FRAGMENT = "the last evening in the flat before he moved out for good" def show(label: str, frag: str) -> None: print(f"\n{'='*70}\n{label}\nfragment: {frag!r}\n{'-'*70}") r = interpret(IMAGES, frag) print(r["interpretation"]) print("\nfilms: " + " · ".join(f"{f['title']} ({f['year']})" for f in r["films"])) def main() -> None: print(f"model={os.environ.get('CHALCHITRA_MODEL', 'default')}") show("A — images only", "") show("B — images + personal fragment", FRAGMENT) if __name__ == "__main__": main()