Skip to content

Commit c7d1ad7

Browse files
committed
import style
1 parent 99b2e79 commit c7d1ad7

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

speech/cloud-client/quickstart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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(

speech/cloud-client/transcribe.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030

3131
def 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

5353
def 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(

speech/cloud-client/transcribe_async.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
def 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

6262
def 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(

speech/cloud-client/transcribe_streaming.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828

2929
def 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()

0 commit comments

Comments
 (0)