Skip to content

Commit e558f18

Browse files
dizcologybusunkim96
authored andcommitted
use region tags [(#1022)](#1022)
1 parent bdccb5f commit e558f18

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

speech/snippets/transcribe.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
# [END import_libraries]
2929

3030

31+
# [START def_transcribe_file]
3132
def transcribe_file(speech_file):
3233
"""Transcribe the given audio file."""
3334
from google.cloud import speech
@@ -55,8 +56,10 @@ def transcribe_file(speech_file):
5556
for alternative in alternatives:
5657
print('Transcript: {}'.format(alternative.transcript))
5758
# [END migration_sync_response]
59+
# [END def_transcribe_file]
5860

5961

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

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

8185

8286
if __name__ == '__main__':

speech/snippets/transcribe_async.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import time
2828

2929

30+
# [START def_transcribe_file]
3031
def transcribe_file(speech_file):
3132
"""Transcribe the given audio file asynchronously."""
3233
from google.cloud import speech
@@ -63,8 +64,10 @@ def transcribe_file(speech_file):
6364
print('Transcript: {}'.format(alternative.transcript))
6465
print('Confidence: {}'.format(alternative.confidence))
6566
# [END migration_async_response]
67+
# [END def_transcribe_file]
6668

6769

70+
# [START def_transcribe_gcs]
6871
def transcribe_gcs(gcs_uri):
6972
"""Asynchronously transcribes the audio file specified by the gcs_uri."""
7073
from google.cloud import speech
@@ -93,6 +96,7 @@ def transcribe_gcs(gcs_uri):
9396
for alternative in alternatives:
9497
print('Transcript: {}'.format(alternative.transcript))
9598
print('Confidence: {}'.format(alternative.confidence))
99+
# [END def_transcribe_gcs]
96100

97101

98102
if __name__ == '__main__':

speech/snippets/transcribe_streaming.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# [END import_libraries]
2727

2828

29+
# [START def_transcribe_streaming]
2930
def transcribe_streaming(stream_file):
3031
"""Streams transcription of the given audio file."""
3132
from google.cloud import speech
@@ -62,6 +63,7 @@ def transcribe_streaming(stream_file):
6263
print('Confidence: {}'.format(alternative.confidence))
6364
print('Transcript: {}'.format(alternative.transcript))
6465
# [END migration_streaming_response]
66+
# [END def_transcribe_streaming]
6567

6668

6769
if __name__ == '__main__':

0 commit comments

Comments
 (0)