Opossum Search

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

Opossum search

This notebook contains a simple example of generating code with the Gemini API and Gemini Flash. Just for fun, you'll prompt the model to create a web app called "Opossum Search" that searches Google with "opossum" appended to the query.

An image of the opossum search web app running in a browser

The opossum image above is from Wikimedia Commons, and shared under a CC BY-SA 2.5 license.

[2]

Set up your API key

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 image quickstart for an example.

[3]

Prompt the model to generate the web app.

[4]
[5]
[6]
MODEL_ID
[7]

Run the output locally

You can start a web server as follows.

  • Save the HTML output to a file called search.html
  • In your terminal run python3 -m http.server 8000
  • Open your web browser, and point it to http://localhost:8000/search.html

Display the output in IPython

Like all LLMs, the output may not always be correct. You can experiment by rerunning the prompt, or by writing an improved one (and/or better system instructions). Have fun!

[8]