"""Image editing (text + image -> image) with Nano Banana."""
from google import genai
from PIL import Image

def main() -> None:
    client = genai.Client()
    prompt = "Add a nano banana on the table, keep lighting consistent, cinematic tone."
    img = Image.open("input.png")

    resp = client.models.generate_content(
        model="gemini-2.5-flash-image",
        contents=[prompt, img],
    )

    for i, part in enumerate(resp.parts):
        if getattr(part, "inline_data", None):
            out = f"edited_{i}.png"
            part.as_image().save(out)
            print(f"Saved {out}")

if __name__ == "__main__":
    main()
