# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
This project is designed to explore metadata generated by Gemini using Google Cloud Platform. There are two resources in this repo:
Item | Description |
---|---|
Notebook | A metadata creation pipeline in a colab notebook. |
Metadata Explorer | A sample streamlit app that shows metadata generated by gemini. |
We've added a notebook that showcases how Gemini works with multi-modal inputs to generate insights and support customers that have either audio, image, or video assets. More info on Gemini's multi-modality here.
Specifically the scenario we are showcasing in this notebook is the creation of a pipeline that given a set of assets in a Google Cloud Storage bucket is able to create metadata that is accurate and informative about these assets.
- Create the resources as required in the config.yaml file and their corresponding items in the gcp project.
- Run the metadata ingestion pipeline as per the notebook.
Choose one of the following options to deploy the streamlit application once you've finished generating your metadata.
- Set up your application credentials by storing your json export of your service account key in secrets/credentials.json.
- Create a python virtual env
python3 -m venv .venv
- Run the shell command that launches your streamlit app
sh run.sh
To build a container and deploy it to cloud run we will need to:
- Create your environment dependent config file (config.yaml)
- Sort out authentication with application credentials (secrets/credentials.json)
- Build the container.
- Push the container to Artifact Registry.
- Deploy the container to Cloud Run.
Running the following commands in Cloud Shell will make authentication process easier.
export PROJECT_IDENTIFIER='project_id'
export CONTAINER_VERSION='v1.0'
export CONTAINER_NAME='metadata_explorer'
export IMAGE_URI=us.gcr.io/$PROJECT_IDENTIFIER/$CONTAINER_NAME:$CONTAINER_VERSION
export REGION='us-central1'
Change the variables accordingly.
docker build -t $IMAGE_URI .
Once that is done push it to the Artifact Registry:
docker push $IMAGE_URI
export CLOUDRUN_SERVICE=metadata-explorer
gcloud run deploy $CLOUDRUN_SERVICE \
--image=us.gcr.io/$PROJECT_IDENTIFIER/$CONTAINER_NAME:$CONTAINER_VERSION \
--region=$REGION \
--project=$PROJECT_IDENTIFIER \
&& gcloud run services update-traffic $CLOUDRUN_SERVICE --to-latest --region=$REGION
This repository itself is not an officially supported Google product. The code in this repository is for demonstrative purposes only.