Tutorial of Running Google Cloud Speech-to-Text Service on Local Computer

quick start (all article) Figure 0:\colon Official Quickstart for Google Cloud Speech-to-Text Service

如Figur 0所示,Google官方有針對使用Client Libraries方式呼叫Speech-to-Text API的基本操作。我們針對Python部分的安裝特別說明。

  1. 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
  2. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file
    export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"
    
  3. Install and initialize the Cloud SDK
    • install :\colon ./google-cloud-sdk/install.sh
    • initialize :\colon ./google-cloud-sdk/bin/gcloud init
      1. set/select configuration
      2. authenticate user account
      3. set GCP console project connection
  4. Install the client library pip install --upgrade google-cloud-speech

  5. Make 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

  1. Use Anaconda create a virtual environment google-cloud-service
  2. Proceed environment package installation
  3. download google cloud sdk from website
  4. download google cloud sdk confirm window
  5. unzip google cloud sdk gz file
  6. put sdk folder under home directory
  7. install google cloud sdk
  8. list of installed packages
  9. add gcloud cmd to bashrc file
  10. log in to setup credentials
  11. log in webpage (account)
  12. log in webpage (password)
  13. Authentication window
  14. Authentication Success
  15. Select project
  16. Finish google cloud service setting
  17. install google-cloud-speech python package
  18. export GOOGLE_APPLICATION_CREDENTIALS
  19. create run_quick_speechAPI.py
  20. run run_quick_speechAPI.py
  21. Google security warning (extra)
  22. Google security confirmation (extra)
  23. Google security checked (extra)

[0] https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries#client-libraries-install-python

[1]
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/cloud-client/quickstart.py

results matching ""

    No results matching ""