| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
These samples show how to use the Google Cloud Speech API to transcribe audio files, using the REST-based Google API Client Library for Python.
For samples that use the more-efficient GRPC-based client library (including a streaming sample that transcribes audio streamed from your microphone), see ../grpc/.
If you have not already done so, enable the Google Cloud Speech API for your project.
These samples use service accounts for authentication.
Visit the Cloud Console, and navigate to:
API Manager > Credentials > Create credentials > Service account key > New service account.
Create a new service account, and download the json credentials file.
Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your downloaded service account credentials:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials-key.json
If you do not do this, the REST api will return a 403.
See the Cloud Platform Auth Guide for more information.
Clone this repo
git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
cd python-docs-samples/speech/api-clientCreate a virtualenv. This isolates the python dependencies you're about to install, to minimize conflicts with any existing libraries you might already have.
virtualenv env
source env/bin/activateInstall the dependencies
pip install -r requirements.txtEach of the samples takes the audio file to transcribe as the first argument. For example:
python transcribe.py resources/audio.rawYou should see a response with the transcription result.
When you're done running the sample, you can exit your virtualenv:
deactivate
| Back | FazBrowse Home | New Git URL |