"""Text-to-image with Nano Banana (Gemini image generation)."""
from google import genai

def main() -> None:
    client = genai.Client()
    resp = client.models.generate_content(
        model="gemini-2.5-flash-image",
        contents=["Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"],
    )

    # Response can contain text parts and/or image parts.
    for i, part in enumerate(resp.parts):
        if getattr(part, "text", None):
            print(part.text)
        elif getattr(part, "inline_data", None):
            img = part.as_image()
            out = f"out_{i}.png"
            img.save(out)
            print(f"Saved {out}")

if __name__ == "__main__":
    main()
