Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speech: add missing import for code sample #1898

Merged
merged 2 commits into from
Jan 25, 2019
Merged
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
3 changes: 3 additions & 0 deletions speech/cloud-client/transcribe_enhanced_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
def transcribe_file_with_enhanced_model(path):
"""Transcribe the given audio file using an enhanced model."""
# [START speech_transcribe_enhanced_model]
import io
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import exists at the top of the file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beccasaurus Should we also move standard imports inside the functions for imports or just leave them outside.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ones like IO for reading files are 👍 – folks will find it helpful so things don't blow up

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. @anguillanneuf
I'd say we should just make sure we remove the import above then and replace it inside the function where needed. :)


from google.cloud import speech

client = speech.SpeechClient()

# path = 'resources/commercial_mono.wav'
Expand Down