Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion speech/api-client/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ def main(speech_file):
# [END construct_request]
# [START send_request]
response = service_request.execute()
print(json.dumps(response))

# First print the raw json response
print(json.dumps(response, indent=2))

# Now print the actual transcriptions
for result in response.get('results', []):
print('Result:')
for alternative in result['alternatives']:
print(u' Alternative: {}'.format(alternative['transcript']))
# [END send_request]


Expand Down
9 changes: 8 additions & 1 deletion speech/api-client/transcribe_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ def main(speech_file):
if 'done' in response and response['done']:
break

print(json.dumps(response['response']))
# First print the raw json response
print(json.dumps(response['response'], indent=2))

# Now print the actual transcriptions
for result in response['response'].get('results', []):
print('Result:')
for alternative in result['alternatives']:
print(u' Alternative: {}'.format(alternative['transcript']))


# [START run_application]
Expand Down