Google AI Studio is a browser -based IDE for prototyping with generative models.
If you have experience with OpenAI, it is similar to OpenAI's Playground.
There are many ways to access Google AI Studio.
One of them is to visit ai .google .dev
and click Get API Key in Google AI Studio.
This is Google AI Studio.
It lets you quickly try out models and experiment with different prompts.
When you've built something you are happy with, you can export it to code in your
preferred Promix language powered by the Gemini API.
Note that these are emerging technologies and things are moving really fast.
Although the main functionality of Google AI Studio will not change, it is possible
that the layout of the app has been changed when you watch this video.
Google AI Studio provides several interfaces for prompts.
There are Freeform prompts, Structured prompts and Chat prompts.
Let's create a Freeform prompt.
In the left panel of Google AI Studio,
click Create New and then Freeform prompt.
This type of prompt offers an open -ended
experience for generating content and responses to instructions.
Give this prompt a name, for example, Artwork Identification.
We'll experiment with a model that supports both text and images as inputs
in our prompt.
In the right column Model field, select a
model that supports both images and text, such as Gemini provision.
In the prompt area, type Look at the following picture and identify the artwork.
From the insert bar above the prompt area, click Image.
I am choosing a picture I took on my last vacation in Barcelona this year.
I am uploading it.
By the way, the guy in front of the
building is me.
Note that there are many samples of
images of buildings, animals, foods and so on, so that you can play with.
At the bottom of the Google AI Studio window, click Run to generate a reply for
this request.
It is working on my request.
After a few seconds, Gemini provision responded with a short, concise and
correct answer.
The artwork is the Sagrada Familia, a
large unfinished Roman Catholic church in Barcelona.
Notice that you've prototyped a
generative AI application in Minix with just a few clicks.
Amazing, isn't it?
You can now save or share your work or
generate code to use this prompt in your own development environment.
Let's export this prompt as code in Python.
In the top -right corner of the Google AI
Studio, click Get Code.
You can get the code to call this prompt
from the Gemini API from many programming languages like JavaScript, Python,
Kotlin, Swift and so on.
I am selecting Python.
This is the Python code to run this prompt.
You can copy and paste it in your IDE or
you can open it in Colab.
In this example, I am opening the code
for this project in Colab.
To run the code outside of Google AI
Studio, you'll need an API key.
We've already created and added the API
key to Colab in a previous video and now I am giving this notebook access to the key.
In Colab, click the small key icon and toggle Notebook access.
Next in the code, in the Set the API key section, here, change the name of the
secret from the default API key to the name of your secret which is Google API key.
To access the image, you'll need either to permit access to mount Google Drive or
provide the image URL.
I am running the code in this cell that
mounts Google Drive.
This notebook is safe and I'll permit
access and mount Google Drive for convenience.
I will run the code in all the cells.
You can do that by going to Runtime and clicking Run All.
The code is running and you'll get the response from Gemini ProVision using the
API as in Google AI Studio.
Now you can change the parameters,
integrate it with other components and so on.
We are done for now.
In this video, we talked about Google AI Studio which is a browser -based IDE for
prototyping with generative models.