Tutorial of Running Google Cloud Speech-to-Text Service on Local Computer
quick start (all article)
Figure 0 Official Quickstart for Google Cloud Speech-to-Text Service
如Figur 0所示,Google官方有針對使用Client Libraries方式呼叫Speech-to-Text API的基本操作。我們針對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
※ 值得注意的是,因為在anaconda的環境下,執行完第3步後,GOOGLE_APPLICATION_CREDENTIALS的值會被重新設定,所以我們在Realization時,第二步會跟第三步交換,意思就是先Install and initialize Cloud SDK後再export GOOGLE_APPLICATION_CREDENTIALS。
Realization
- Use
Anacondacreate a virtual environmentgoogle-cloud-service
- Proceed environment package installation

- download google cloud sdk from website

- download google cloud sdk confirm window

- unzip google cloud sdk gz file

- put sdk folder under home directory

- install google cloud sdk

- list of installed packages

- add
gcloudcmd to bashrc file
- log in to setup credentials

- log in webpage (account)

- log in webpage (password)

- Authentication window

- Authentication Success

- Select project

- Finish google cloud service setting

- install google-cloud-speech python package

- export GOOGLE_APPLICATION_CREDENTIALS

- create
run_quick_speechAPI.py
- run
run_quick_speechAPI.py
- Google security warning (extra)

- Google security confirmation (extra)

- Google security checked (extra)
