File tree Expand file tree Collapse file tree 4 files changed +15
-13
lines changed
Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ def run_quickstart():
2121 import os
2222
2323 # Imports the Google Cloud client library
24- from google .cloud . speech import SpeechClient
24+ from google .cloud import speech
2525 from google .cloud .speech import types
26-
26+
2727 # Instantiates a client
28- client = SpeechClient ()
28+ client = speech . SpeechClient ()
2929
3030 # The name of the audio file to transcribe
3131 file_name = os .path .join (
Original file line number Diff line number Diff line change 3030
3131def transcribe_file (speech_file ):
3232 """Transcribe the given audio file."""
33- from google .cloud . speech import SpeechClient
33+ from google .cloud import speech
3434 from google .cloud .speech import types
35- client = SpeechClient ()
35+ client = speech . SpeechClient ()
3636
3737 with io .open (speech_file , 'rb' ) as audio_file :
3838 content = audio_file .read ()
@@ -52,9 +52,10 @@ def transcribe_file(speech_file):
5252
5353def transcribe_gcs (gcs_uri ):
5454 """Transcribes the audio file specified by the gcs_uri."""
55- from google .cloud . speech import SpeechClient
55+ from google .cloud import speech
5656 from google .cloud .speech import types
57- client = SpeechClient ()
57+ client = speech .SpeechClient ()
58+
5859 audio = types .RecognitionAudio (uri = gcs_uri )
5960
6061 config = types .RecognitionConfig (
Original file line number Diff line number Diff line change 2929
3030def transcribe_file (speech_file ):
3131 """Transcribe the given audio file asynchronously."""
32- from google .cloud . speech import SpeechClient
32+ from google .cloud import speech
3333 from google .cloud .speech import types
34- client = SpeechClient ()
34+ client = speech . SpeechClient ()
3535
3636 with io .open (speech_file , 'rb' ) as audio_file :
3737 content = audio_file .read ()
@@ -61,9 +61,10 @@ def transcribe_file(speech_file):
6161
6262def transcribe_gcs (gcs_uri ):
6363 """Asynchronously transcribes the audio file specified by the gcs_uri."""
64- from google .cloud . speech import SpeechClient
64+ from google .cloud import speech
6565 from google .cloud .speech import types
66- client = SpeechClient ()
66+ client = speech .SpeechClient ()
67+
6768 audio = types .RecognitionAudio (uri = gcs_uri )
6869
6970 config = types .RecognitionConfig (
Original file line number Diff line number Diff line change 2828
2929def transcribe_streaming (stream_file ):
3030 """Streams transcription of the given audio file."""
31- from google .cloud . speech import SpeechClient
31+ from google .cloud import speech
3232 from google .cloud .speech import types
33- client = SpeechClient ()
33+ client = speech . SpeechClient ()
3434
3535 with io .open (stream_file , 'rb' ) as audio_file :
3636 content = audio_file .read ()
You can’t perform that action at this time.
0 commit comments