Google Cloud Speech-to-Text API using Client Libraries

Figure 0 Official Quickstart for Google Cloud Speech-to-Text Service
Figur 0呈現Google官方針對使用「Client Libraries方式」呼叫「Speech-to-Text API」的基本操作。
安裝Google speech-to-text (使用python語言)
- Setup a GCP Console Project
- Create or select project
 - Enable Google Speech-to-Text API for that project
 - Create a service account
 - Download a private key as JSON
 
 - Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file
export GOOGLE_APPLICATION_CREDENTIALS="[PATH]" - Install and initialize the Cloud SDK
- install  
./google-cloud-sdk/install.sh - initialize  
./google-cloud-sdk/bin/gcloud init- set/select configuration
 - authenticate user account
 - set GCP console project connection
 
 
 - install  
 Install the client library
pip install --upgrade google-cloud-speechMake a simple audio transcription request [1] by
from google.cloud import speech
※ Note: 在anaconda的環境下,執行完第3步後,GOOGLE_APPLICATION_CREDENTIALS的值會被重新設定,所以在Realization時,第二步會跟第三步交換。也就是先Install and initialize Cloud SDK (步驟三)後再export GOOGLE_APPLICATION_CREDENTIALS(步驟二)。