"""Print the hosted InstantID model's input fields (free GET; no prediction). Used to discover the correct img2img / pose / strength field names before wiring an in-place call. Needs REPLICATE_API_TOKEN (this shell only; never committed). """ from __future__ import annotations import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from app.services.instantid_client import ( # noqa: E402 InstantIDUnavailable, fetch_model_input_schema, instantid_model, ) def main() -> int: print(f"model = {instantid_model()}") try: props = fetch_model_input_schema() except InstantIDUnavailable as exc: print(f"FAILED: {exc}") return 1 if not props: print("(no input properties found in schema)") return 0 # Sort by x-order when present so the output reads like the model's form. items = sorted(props.items(), key=lambda kv: kv[1].get("x-order", 999)) for name, spec in items: typ = spec.get("type", "?") desc = (spec.get("description") or "").replace("\n", " ")[:90] default = spec.get("default", None) fmt = spec.get("format", "") tag = f"{typ}{'/' + fmt if fmt else ''}" print(f"- {name} ({tag}) default={default!r}: {desc}") return 0 if __name__ == "__main__": sys.exit(main())