This documentation page is also available as an interactive notebook. You can launch the notebook in
Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
above links.
Pixeltable’s Gemini integration supports two authentication methods:
Prerequisites
For Google AI Studio:
For Vertex AI:
- A Google Cloud project with the Vertex AI API enabled
- The Google Cloud SDK installed and configured
(
gcloud auth application-default login)
Create a Pixeltable directory for this notebook’s demo tables.
Created directory ‘gemini_demo’.
<pixeltable.catalog.dir.Dir at 0x34b1c3430>
Generate content
Create a table with an input column, then add a computed column that
calls Gemini on each row.
Created table ‘text’.
Added 0 column values with 0 errors in 0.00 s
No rows affected.
Inserted 2 rows with 0 errors in 5.90 s (0.34 rows/s)
2 rows inserted.
Added 2 column values with 0 errors in 0.01 s (184.71 rows/s)
2 rows updated.
Generate images with Nano Banana
Use pxtf.gemini.generate_content with model gemini-2.5-flash-image.
This returns a structured response, so extract the image from
response['candidates'][0]['content']['parts'][0]['inline_data']['data'],
as shown below.
Created table ‘nano_banana_images’.
Added 0 column values with 0 errors in 0.00 s
Added 0 column values with 0 errors in 0.00 s
No rows affected.
Inserted 1 row with 0 errors in 6.61 s (0.15 rows/s)
1 row inserted.
Generate images with Imagen
Use pxtf.gemini.generate_images with an Imagen model name such as
imagen-4.0-generate-001.
This returns a pxt.Image directly, so you can use it in computed
columns without JSON subscripting.
Created table ‘images’.
Added 0 column values with 0 errors in 0.00 s
No rows affected.
Inserted 1 row with 0 errors in 11.87 s (0.08 rows/s)
1 row inserted.
Generate video with Veo
Created table ‘videos’.
Added 0 column values with 0 errors in 0.00 s
No rows affected.
Inserted 1 row with 0 errors in 46.34 s (0.02 rows/s)
1 row inserted.
Generate video from an existing image
We’ll add a computed column to our nano_t table to animate the
generated image. You can pass images_t.generated_image from the Imagen
section above the same way.
Learn more
For a deeper end-to-end example, see RAG Operations in
Pixeltable.