Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dizcology authored and busunkim96 committed Sep 3, 2020
1 parent 6498258 commit fe0875a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# [END import_libraries]


# [START def_transcribe_file]
def transcribe_file(speech_file):
"""Transcribe the given audio file."""
from google.cloud import speech
Expand Down Expand Up @@ -55,8 +56,10 @@ def transcribe_file(speech_file):
for alternative in alternatives:
print('Transcript: {}'.format(alternative.transcript))
# [END migration_sync_response]
# [END def_transcribe_file]


# [START def_transcribe_gcs]
def transcribe_gcs(gcs_uri):
"""Transcribes the audio file specified by the gcs_uri."""
from google.cloud import speech
Expand All @@ -77,6 +80,7 @@ def transcribe_gcs(gcs_uri):

for alternative in alternatives:
print('Transcript: {}'.format(alternative.transcript))
# [END def_transcribe_gcs]


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import time


# [START def_transcribe_file]
def transcribe_file(speech_file):
"""Transcribe the given audio file asynchronously."""
from google.cloud import speech
Expand Down Expand Up @@ -63,8 +64,10 @@ def transcribe_file(speech_file):
print('Transcript: {}'.format(alternative.transcript))
print('Confidence: {}'.format(alternative.confidence))
# [END migration_async_response]
# [END def_transcribe_file]


# [START def_transcribe_gcs]
def transcribe_gcs(gcs_uri):
"""Asynchronously transcribes the audio file specified by the gcs_uri."""
from google.cloud import speech
Expand Down Expand Up @@ -93,6 +96,7 @@ def transcribe_gcs(gcs_uri):
for alternative in alternatives:
print('Transcript: {}'.format(alternative.transcript))
print('Confidence: {}'.format(alternative.confidence))
# [END def_transcribe_gcs]


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# [END import_libraries]


# [START def_transcribe_streaming]
def transcribe_streaming(stream_file):
"""Streams transcription of the given audio file."""
from google.cloud import speech
Expand Down Expand Up @@ -62,6 +63,7 @@ def transcribe_streaming(stream_file):
print('Confidence: {}'.format(alternative.confidence))
print('Transcript: {}'.format(alternative.transcript))
# [END migration_streaming_response]
# [END def_transcribe_streaming]


if __name__ == '__main__':
Expand Down

0 comments on commit fe0875a

Please sign in to comment.