Try the Vertex AI Gemini API  |  Generative AI on Vertex AI  |  Google Cloud

PHOTO EMBED

Tue May 07 2024 07:34:17 GMT+0000 (Coordinated Universal Time)

Saved by @rosa #python

import vertexai

from vertexai.generative_models import GenerativeModel, Part

# TODO(developer): Update and un-comment below line
# project_id = "PROJECT_ID"

vertexai.init(project=project_id, location="us-central1")

model = GenerativeModel(model_name="gemini-1.0-pro-vision-001")

response = model.generate_content(
    [
        Part.from_uri(
            "gs://cloud-samples-data/generative-ai/image/scones.jpg",
            mime_type="image/jpeg",
        ),
        "What is shown in this image?",
    ]
)

print(response.text)
content_copyCOPY

https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal