Python

A shared tag with AI prompts and code snippets

From workspace: Google Gemini

Team: Nano Banana

Total snippets: 2

Google Gemini

Python

2 snippets

Image editing (text-and-image-to-image) python

The following example demonstrates uploading base64 encoded images. For multiple images, larger payloads, and supported MIME types, check the Image understanding page.

from google import genai from google.genai import types from PIL import Image from io import BytesIO client = genai.Client() prompt = ( "Create a picture of my cat eating a nano-banana in a " "fancy restaurant under the Gemini...

Image generation (text-to-image) Python

The following code demonstrates how to generate an image based on a descriptive prompt.

from google import genai from google.genai import types from PIL import Image from io import BytesIO client = genai.Client() prompt = ( "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme" ) response =...