Skip to content

Speech gapic client library - #1012

Merged
theacodes merged 29 commits into
GoogleCloudPlatform:masterfrom
dizcology:speech_gapic
Jul 14, 2017
Merged

Speech gapic client library#1012
theacodes merged 29 commits into
GoogleCloudPlatform:masterfrom
dizcology:speech_gapic

Conversation

@dizcology

Copy link
Copy Markdown
Member

Updating python code samples to use the GAPIC python client library for Speech API.

Merge only after the client library is released.

@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 5, 2017
Comment threadspeech/cloud-client/requirements.txt Outdated
@@ -1 +1 @@
google-cloud-speech==0.26.0
google-cloud-speech>=0.27.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prefer all requirements be ==, for maximum reproducibility.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done

language_code='en-US')

# In practice requests should be a generator yielding chunks of audio data.
requests = [request]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be clearer if you only construct the StreamingRecognizeRequest within a generator. ie:

requests= (types.StreamingRecognizeRequest(audio_content=c) forcin [content])

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done

def listen_print_loop(responses):
"""Iterates through server responses and prints them.

The results_gen passed is a generator that will block until a response

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should update the docstring as well

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

updated.

@jerjoujerjou self-assigned this Jul 12, 2017

@theacodestheacodes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks mostly good to me, with a few nits.

Comment threadspeech/cloud-client/quickstart.py Outdated
audio = types.RecognitionAudio(content=content)

config = types.RecognitionConfig(
encoding='LINEAR16',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there an enum for this?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

There is, but requires the additional import of from google.cloud.speech import enums. I was keeping it consistent with the existing samples.

language_code='en-US')

# In practice requests should be a generator yielding chunks of audio data.
requests = (types.StreamingRecognizeRequest(audio_content=c)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please use a more descriptive variable name rather than c.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done.

encoding='LINEAR16',
sample_rate_hertz=RATE,
language_code=language_code)
streaming_config = types.StreamingRecognitionConfig(config=config,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: start a newline at the opening ( to avoid hanging indents like this.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

done.

@theacodes

theacodes commented Jul 13, 2017 via email

Copy link
Copy Markdown
Contributor

@dizcology

Copy link
Copy Markdown
MemberAuthor

in the current form of the GAPIC client library enums is its own module.

@theacodes

theacodes commented Jul 13, 2017 via email

Copy link
Copy Markdown
Contributor

@theacodestheacodes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This LGTM, but I can't merge it until the 0.27.0 version of the library is published. Have you run these tests locally?

@dizcology

Copy link
Copy Markdown
MemberAuthor

I have tested with a client library provided to me to migrate these samples, but yes, let's wait after the package has been published and I have the chance to run the test against the published client.

@dizcology

Copy link
Copy Markdown
MemberAuthor

@theacodes
theacodes merged commit 218bc59 into GoogleCloudPlatform:masterJul 14, 2017
busunkim96 pushed a commit to busunkim96/python-speech that referenced this pull request Sep 1, 2020
…-samples#1012)
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
busunkim96 pushed a commit to googleapis/python-speech that referenced this pull request Sep 3, 2020
…-samples#1012)
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
telpirion pushed a commit that referenced this pull request Jan 13, 2023
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
dandhlee pushed a commit that referenced this pull request Feb 9, 2023
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
telpirion pushed a commit that referenced this pull request Mar 13, 2023
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
atulep pushed a commit to googleapis/google-cloud-python that referenced this pull request Apr 6, 2023
…-samples#1012)
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
atulep pushed a commit to googleapis/google-cloud-python that referenced this pull request Apr 6, 2023
…-samples#1012)
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
atulep pushed a commit to googleapis/google-cloud-python that referenced this pull request Apr 18, 2023
…-samples#1012)
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
parthea pushed a commit to googleapis/google-cloud-python that referenced this pull request Oct 22, 2023
…-samples#1012)
* Migrate quickstart to GAPIC client library
* Migrate transcribe to GAPIC client library
* Migrate transcribe_async to GAPIC client library
* Migrate transcribe_streaming to GAPIC client library
* clean up
* clean up
* Import from google.cloud.speech
* update transcribe samples
* import in alphabetic order
* remove unused variable
* use strings instead of enums
* restructure code
* comment on sreaming requests
* import style
* flake
* correct indent
* migrate transcribe_streaming_mic to gapic
* update google-cloud-speech version requirement
* addressing review comments
* at the end of the audio stream, put None to signal to the generator
* flake
* addressing github review comments
* add region tags for migration guide
* update README
* rst format
* bullet
* addressing PR review comments
* use enums
* remove a word
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@dizcology@theacodes@jerjou@googlebot