Google Distributed Cloud (GDC) air-gapped offers three Vertex AI pre-trained services in a disconnected environment. These services include Optical Character Recognition (OCR), Translation, and Speech-to-Text.
Before you begin
Before downloading the tar file and extracting the client libraries, follow these instructions:
If you haven't downloaded the gdcloud CLI, see Download the gdcloud CLI.
Sign in to your environment.
gdcloud set context && gdcloud auth login YOURCREDENTIAL
Create a service account. In this example, the service account is named sa-foo.
gdcloud iam service-account create sa-foo
Bind the service account to the role
cloud-ai-viewer
, which grants permissions to access the Vertex AI services.gdcloud iam service-account role-binding sa-foo --role=cloudai-viewer
Generate authentication credentials for the service account.
gdcloud iam service-account get-cred sa-foo
Verify that you have Python version 3.7 installed.
Installation
After completing the prerequisites, follow these steps to download the tar file, and use the tar file to install the client libraries:
Download the client library you want to install. To learn which client libraries are available, see Client libraries.
wget https://GDC_URL/.well-known/static/client-libraries/CLIENT_LIBRARY
Replace the following:
GDC_URL
: the URL of your organization in GDC.CLIENT_LIBRARY
: the filename of the client library you want to download.
Extract the library file.
tar -zxf centos-google-cloud-speech-2.15.0.tar.gz
Use the
pip install
command to install the libraries into GDC.pip install -r google-cloud-<LIB>/requirements.txt --no-index --find-links google-cloud-<LIB>
Create the following Python script to import the Translation client library:
from google.cloud import translate translate_client = translate.Client( client_options={"API_ENDPOINT": "https://foo-translation.googleapis.com"}) result = translate_client.translate(text, target_language="ru")
Save the Python script as
translation-service.py
.Run the Python script.
python translation-service.py
How to run client libraries
There are two ways to run a client library:
Follow the steps in the Installation section.
Use your notebook to import the library. If you need to set up a notebook, see Vertex AI Workbench.
Client libraries
CentOS and Ubuntu OS support is provided for Optical Character Recognition (OCR), Translation, and Speech-to-Text client libraries, which GDC hosts.
The file names are in the following format:
<OS>-google-cloud-<lib>-<version_number>.tar.gz
.
- centos-google-cloud-speech-2.15.0.tar.gz
- centos-google-cloud-translate-3.8.0.tar.gz
- centos-google-cloud-vision-3.0.0.tar.gz
- ubuntu-google-cloud-speech-2.15.0.tar.gz
- ubuntu-google-cloud-translate-3.8.0.tar.gz
- ubuntu-google-cloud-vision-3.0.0.tar.gz