Notebooks
G
Google Gemini
Market A Jet Backpack

Market A Jet Backpack

gemini-cookbookgemini-apiexamplesgemini
Copyright 2025 Google LLC.
[1]

Create a marketing campaign from a product sketch of a Jet Backpack

This notebook contains a code example of using the Gemini API to analyze a a product sketch (in this case, a drawing of a Jet Backpack), create a marketing campaign for it, and output taglines in JSON format.

Setup

[2]
[3]

To run the following cell, your API key must be stored it in a Colab Secret named GOOGLE_API_KEY. If you don't already have an API key, or you're not sure how to create a Colab Secret, see the Authentication quickstart for an example.

[4]

Additionally, select the model you want to use from the available options below:

[5]
MODEL_ID

Marketing Campaign

  • Product Name
  • Description
  • Feature List / Descriptions
  • H1
  • H2

Analyze Product Sketch

First you will download a sample image to be used:

[6]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  349k  100  349k    0     0  2692k      0 --:--:-- --:--:-- --:--:-- 2706k

You can view the sample image to understand the prompts you are going to work with:

[7]
Output

Now define a prompt to analyze the sample image:

[8]
  • Set the model to return JSON by setting response_mime_type="application/json".
  • Describe the schema for the response using a TypedDict.
[9]
[10]
[11]
{
    "description": "The image is a sketch of a product called the Jetpack Backpack. It appears to be a normal looking, lightweight backpack with padded strap supports that fits an 18\" laptop. The backpack has retractable boosters and has USB-C charging. It has a 15 minute battery life and is steam-powered, making it a green/clean energy source.",
    "features": [
        "Fits 18\" laptop",
        "Lightweight",
        "Padded strap support",
        "Retractable boosters",
        "USB-C charging",
        "15-min battery life",
        "Steam-powered"
    ]
}

Note: Here the model is just following text instructions for how the output json should be formatted. The API also supports a strict JSON mode where you specify a schema, and the API uses "Controlled Generation" (aka "Constrained Decoding") to ensure the model follows the schema, see the JSON mode quickstart for details.

Generate marketing ideas

Now using the image you can use Gemini API to generate marketing names ideas:

[12]
Dropdown(description='Name:', options=('SteamPack', 'BoostBack', 'EcoJet', 'GreenLift', 'AirStride', 'AscendPa…

Finally you can work on generating a page for your product campaign:

[13]
[14]
[15]
[16]
[17]
[18]
[
    {
        "h1": "SteamPack: Eco-Flight",
        "h2": "The steam-powered backpack that gets you there sustainably."
    },
    {
        "h1": "Your Green Commute, Elevated",
        "h2": "SteamPack: The eco-friendly jetpack backpack."
    },
    {
        "h1": "Fly Green, Travel Light",
        "h2": "Introducing SteamPack: The lightweight, steam-powered jetpack backpack."
    },
    {
        "h1": "SteamPack: Eco-Friendly Flight",
        "h2": "Soar above the traffic with this sustainable jetpack backpack."
    },
    {
        "h1": "The Future of Green Travel is Here",
        "h2": "SteamPack: Your lightweight, steam-powered solution for short hops."
    },
    {
        "h1": "Upgrade Your Commute",
        "h2": "SteamPack: The lightweight backpack that turns into a steam-powered jetpack."
    },
    {
        "h1": "Green Power, Personal Flight",
        "h2": "Introducing SteamPack: the backpack that gives you a boost, sustainably."
    },
    {
        "h1": "Beyond Backpacks. Beyond Expectations.",
        "h2": "SteamPack: The steam-powered commute solution."
    },
    {
        "h1": "The Eco-Friendly Way To Fly.",
        "h2": "SteamPack: Your lightweight, steam-powered backpack companion."
    },
    {
        "h1": "SteamPack: Lightweight and Clean",
        "h2": "A sustainable alternative for short distance travel."
    }
]
[19]
[20]
[21]
```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SteamPack - Fly Green, Travel Light</title>
    <style>
        body {
            font-family: sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f0f0f0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(to bottom, #a8edea, #fed6e3);
        }

        .splash-container {
            text-align: center;
            padding: 40px;
            background-color: rgba(255, 255, 255, 0.8);
            border-radius: 10px;
            box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
            max-width: 800px;
            width: 90%;
        }

        h1 {
            font-size: 3em;
            margin-bottom: 10px;
            color: #333;
        }

        h2 {
            font-size: 1.5em;
            color: #666;
            font-weight: normal;
        }

        .cta-button {
            display: inline-block;
            padding: 15px 30px;
            background-color: #4CAF50;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            margin-top: 20px;
            font-size: 1.2em;
        }

        .cta-button:hover {
            background-color: #3e8e41;
        }
    </style>
</head>
<body>
    <div class="splash-container">
        <h1>Fly Green, Travel Light</h1>
        <h2>Introducing SteamPack: The lightweight, steam-powered jetpack backpack.</h2>
        <a href="#" class="cta-button">Learn More</a>
    </div>
</body>
</html>
```
[22]