Explore Nano Banana 2 Lite in the Gemini Platform Studio UI

Check my progress

/ 25

Set up the Colab Enterprise notebook environment

Check my progress

/ 25

Query Nano Banana 2 Lite from your notebook

Check my progress

/ 25

Generate images that include text using Nano Banana 2 Lite

Check my progress

/ 25

This lab may incorporate AI tools to support your learning.
This content is not yet optimized for mobile devices.
For the best experience, please visit us on a desktop computer using a link sent by email.

GENAI131

Overview

In this lab, you will explore the image generation and editing capabilities of (), Google's fastest image generation and editing model.

This model produces text and image outputs, and is popular for the degree of control it offers by allowing you to edit images simply by describing the changes you would like to see. Learn more about its capabilities from the Gemini 3.1 Flash-Lite Image model documentation.

Objectives

In this lab, you use Gemini Platform Studio and the Google Gen AI SDK for Python to interact with Nano Banana 2 Lite to:

  • Generate and iteratively edit images using the Gemini Platform Studio UI.
  • Generate photorealistic images from code by using other images as inputs.
  • Generate non-photo images with text based on other images.

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup pane with the following:

    • The Open Google Cloud console button
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. In the Lab Setup section, right-click Open Google Cloud console and select Open link in new window (or alternatively right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Setup pane.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Setup pane.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field. Navigation menu icon and Search field

Task 1. Explore Nano Banana 2 Lite in Gemini Platform Studio

In this section, you will use Gemini Platform Studio to explore Nano Banana 2 Lite.

  1. In the Google Cloud console, from the Navigation menu (Navigation menu), select Gemini Platform.

  2. In the left navigation pane under Gemini Platform, click Studio.

  3. If an Enable APIs banner appears at the top of the Studio page, click Enable APIs and confirm by clicking Enable.

  4. In the upper-left corner of Studio, click + New, then click Chat to open the chat prompt.

  5. In the chat input, type /model and press Enter to bring up the model settings.

  6. Select from the Image tab.

  7. At the bottom-left of the prompt input box, click the + button and select Import from Cloud Storage.

  8. Select the bucket gs://-bucket/ and select the image cymbal-shops-ui.png.

  9. Click Select.

  10. Click the image thumbnail that appears in the prompt box to preview a higher-resolution version of the image. It is a UI mockup of a new mobile website for Cymbal Shops.

    Select the image in the prompt
  11. Click Close to exit the image preview.

  12. In the prompt input box, enter the following text to accompany the image, then click the Submit (arrow) button or press Enter.

    Create a closeup photo featuring a young couple from Thiruvananthapuram in a kitchen cooking Kerala Parotta and looking at this UI on a tablet screen. They should be holding the tablet in such a way that we can see the UI on the screen.

    Example Output (yours may be different):

    A couple in TVM viewing your UI Note: Not every image generated will be exactly as expected, and if you receive a 429 quota error, wait a moment and re-run the prompt.
  13. In the same chat session, enter the following follow-up prompt and click Submit to see how Nano Banana 2 Lite maintains character consistency across turns:

    Show the same couple opening their own restaurant.

    Example Output (yours may be different):

    The couple opening their restaurant
  14. (Optional) Click New chat in the upper-left corner of Studio and try the prompt again to see variations.

Click Check my progress to verify the objectives. Explore Nano Banana 2 Lite in the Gemini Platform Studio UI

Task 2. Set up a Colab Enterprise notebook environment

In this section, you will open a Colab Enterprise notebook to send requests to the Nano Banana 2 Lite model using the Python Google Gen AI SDK.

  1. In the Google Cloud console, from the Navigation menu (Navigation menu), select Gemini Platform > Notebooks > Colab Enterprise.

  2. In the left Colab Enterprise navigation pane, click My notebooks.

  3. From the Region dropdown, select , then click + New notebook.

  4. When the notebook opens, use the File > Rename menu item to rename the notebook to:

    nano-banana.ipynb
  5. Click Connect in the upper-right corner of the notebook UI to create and connect to a runtime environment.

  6. If the Open OAuth popup dialog appears, click Open. In the Choose an account window, select your Qwiklabs student account () to authorize the notebook.

  1. Creating the runtime takes a few minutes. When connected, you will see the runtime RAM and disk status indicator in the upper right:

    RAM and disk status display Note: If connecting to the runtime takes longer than expected, refresh the browser page, click Connect again, and wait about a minute for the runtime to connect.

    You can dismiss any pop-up guides or notifications that appear.

  2. Once the runtime is active, paste the following into the first code cell and run it by pressing Shift + Enter or clicking the Play button to the left of the cell:

    !pip install --upgrade --quiet google-genai Note: Ignore any dependency compatibility warnings during library installation.
  3. When the cell finishes running (indicated by [1] appearing to the left of the cell), restart the kernel from the top menu by selecting Runtime > Restart session and clicking Yes.

  4. In the next code cell, paste and run the following code to import packages and initialize the genai.Client:

    from io import BytesIO from PIL import Image from google.cloud import storage from google import genai from google.genai import types storage_client = storage.Client() PROJECT_ID = "{{{project_0.project_id | YOUR_GCP_PROJECT_ID}}}" BUCKET_NAME = f"{PROJECT_ID}-bucket" NANO_BANANA = "{{{project_0.startup_script.gemini_flash_lite_image_model_id | Gemini Flash-Lite Image Model}}}" client = genai.Client( vertexai=True, project=PROJECT_ID, location="global", )
  5. In the next code cell, paste and run the following helper functions to display images in your notebook:

    def display_image(image_data): """Displays an image in a Colab notebook from PNG data.""" img = Image.open(BytesIO(image_data)) img.save('my_image.png') display(img) def display_img_from_gcs(bucket_name, img_path): """Downloads bytes and displays an image stored in GCS.""" bucket = storage_client.get_bucket(bucket_name) blob = bucket.get_blob(img_path) display_image(blob.download_as_bytes())

Click Check my progress to verify the objectives. Set up the Colab Enterprise notebook environment

Task 3. Query Nano Banana 2 Lite from your notebook

  1. In a new code cell, paste and run the following to preview the jacket product image stored in Cloud Storage:

    display_img_from_gcs(BUCKET_NAME, "product_jacket_932.png")
  2. In a new code cell, paste and run the following to view the dress product image:

    display_img_from_gcs(BUCKET_NAME, "product_dress_128.png")
  3. Paste and run the following to create a genai.types.Part for each image and text prompt, and combine them into a genai.types.Content object:

    image1 = types.Part.from_uri( file_uri=f"gs://{BUCKET_NAME}/product_dress_128.png", mime_type="image/png", ) image2 = types.Part.from_uri( file_uri=f"gs://{BUCKET_NAME}/product_jacket_932.png", mime_type="image/png", ) prompt = types.Part.from_text( text=("Create a photo featuring a young couple " "from Austin, TX wearing these clothing " "products on a walk through the Greenbelt.") ) content = [ types.Content( role="user", parts=[image1, image2, prompt] ) ]
  4. Configure a genai.types.GenerateContentConfig with response_modalities set to ["TEXT", "IMAGE"] and retry options to handle transient quota limits. Paste and run this code:

    gen_config = types.GenerateContentConfig( response_modalities = ["TEXT", "IMAGE"], http_options = types.HttpOptions( retry_options = types.HttpRetryOptions( attempts = 60, initial_delay = 1, exp_base = 2, max_delay = 4 ) ) )
  5. Paste and run the following code to call generate_content and display the generated image:

    response = client.models.generate_content( model = NANO_BANANA, contents = content, config = gen_config, ) for part in response.candidates[0].content.parts: if part.inline_data: image_data = part.inline_data.data display_image(image_data)

    Example Output (yours may be different):

    A couple in Austin wearing the products.

Click Check my progress to verify the objectives. Query Nano Banana 2 Lite from your notebook

Task 4. Use Nano Banana 2 Lite to generate images that include text

  1. At the bottom of the notebook, hover over the space below the last cell and click + Text to add a Markdown text cell.

    Add a text cell
  2. Paste the following Markdown text and run the cell to render the heading:

    ## Edit a UI with Nano Banana 2 Lite
  3. In the new code cell below the Markdown heading, paste and run the following code to display another image to edit—the Lyria music generation UI from Gemini Platform Studio:

    display_img_from_gcs(BUCKET_NAME, "lyria_ui.png")
  4. In a new code cell, paste and run the following code to generate a Podcast Studio UI design in the same style:

    ui_img_part = types.Part.from_uri( file_uri=f"gs://{BUCKET_NAME}/lyria_ui.png", mime_type="image/png", ) text1 = types.Part.from_text( text=""" Create a UI in the same style. It should be called Podcast Studio. Include configuration options: - A UI slider to set the number of hosts (from 1 to max 4) - A UI slider to set the minutes in length (from 2 to max 40) The prompt input box should tell the user to specify details of the episode topic. """ ) contents = [ types.Content( role="user", parts=[ui_img_part, text1] ) ] response = client.models.generate_content( model = NANO_BANANA, contents = contents, config = gen_config, ) for part in response.candidates[0].content.parts: if part.inline_data: image_data = part.inline_data.data display_image(image_data)
  5. In a new code cell, paste and run the following code to upload and edit the previous image, replacing the "Advanced Options" section with a Podcast Language dropdown:

    bucket = storage_client.get_bucket(BUCKET_NAME) blob = bucket.blob("original_ui.png") blob.upload_from_filename("my_image.png") original_ui_img_part = types.Part.from_uri( file_uri=f"gs://{BUCKET_NAME}/original_ui.png", mime_type="image/png", ) text = types.Part.from_text( text=""" Modify this image to remove the "Advanced Options" area. Keep current configuration options (Number of hosts and Minutes in Length) and add a new dropdown for Podcast Language. """ ) contents = [ types.Content( role="user", parts=[original_ui_img_part, text] ) ] response = client.models.generate_content( model = NANO_BANANA, contents = contents, config = gen_config, ) for part in response.candidates[0].content.parts: if part.inline_data: image_data = part.inline_data.data display_image(image_data)

    Example Output (yours may be different):

    Example output showing a Podcast Studio UI

Click Check my progress to verify the objectives. Generate images that include text using Nano Banana 2 Lite

Optional: Keep Experimenting

You have now used Nano Banana 2 Lite from both Gemini Platform Studio and the Python SDK. This section is not graded, so feel free to explore:

  • In your Colab Enterprise notebook:

    • Modify the prompts in Task 3 to place the couple in a different city or activity.
    • Modify the UI prompt in Task 4 to design another application (such as a weather app or music player) in the same style.
  • In Gemini Platform Studio:

    • Return to Gemini Platform > Studio and click New chat.
    • Upload the lab images (product_jacket_932.png or lyria_ui.png) from Cloud Storage and test new scenes or multi-turn edits.

Congratulations!

In this lab, you successfully explored Nano Banana 2 Lite by generating and editing images in Gemini Platform Studio, generating photorealistic images from code using multiple input images, and creating and editing UI mockups that include text.

Manual Last Updated November 26, 2026

Lab Last Tested November 26, 2026

Copyright 2026 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

This content is not currently available

We can notify you via email when it becomes available

Great!

We can contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.