Skip to content

Commit

Permalink
Add comments for config options.
Browse files Browse the repository at this point in the history
Some folks were tripping up on this.
  • Loading branch information
Jerjou Cheng committed Jul 22, 2016
1 parent 439ca4c commit f556856
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions speech/api/speech_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_speech_service():
# [END authenticating]


def main(speech_file):
def main(speech_file, language_code='en-US'):
"""Transcribe the given audio file.
Args:
Expand All @@ -60,8 +60,12 @@ def main(speech_file):
service_request = service.speech().syncrecognize(
body={
'config': {
'encoding': 'LINEAR16',
'sampleRate': 16000
# There are a bunch of config options you can specify. See
# https://cloud.google.com/speech/reference/rest/Shared.Types/RecognitionConfig # noqa
# for the full list.
'encoding': 'LINEAR16', # raw 16-bit signed LE samples
'sampleRate': 16000, # 16 khz
'languageCode': language_code, # a BCP-47 language tag
},
'audio': {
'content': speech_content.decode('UTF-8')
Expand Down

0 comments on commit f556856

Please sign in to comment.