Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Latest commit

 

History

History
History
 
 

README.md

Outline

Google Cloud Speech API Sample (REST API)

This example demos accessing the Google Cloud Speech API via its REST API.

Prerequisites

Enable the Speech API

If you have not already done so, enable the Google Cloud Speech API for your project. You must be whitelisted to do this.

Set Up to Authenticate With Your Project's Credentials

The example uses a service account for OAuth2 authentication. So next, set up to authenticate with the Speech API using your project's service account credentials.

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.

Then, set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your downloaded service account credentials before running this example:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials-key.json

If you do not do this, you will see an error that looks something like this when you run the example script: ...<HttpError 403 when requesting https://speech.googleapis.com/v1/speech:recognize?alt=json returned "Request had insufficient authentication scopes.">. See the Cloud Platform Auth Guide for more information.

Run the example

$ python speechrest.py resources/audio.raw

You should see a response with the transcription result.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.