GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Can I run GRPC streaming analyze just once? · Issue #615 · GoogleCloudPlatform/python-docs-samples

Can I run GRPC streaming analyze just once? #615

New issue
Copy link
New issue
Copy link
Closed
Closed
Can I run GRPC streaming analyze just once?#615
Copy link
Assignees
jerjou
Labels
help wantedWe'd love to have community involvement on this issue.

Description

@thecloudist
thecloudist
opened on Oct 25, 2016
Issue body actions

The multi-threaded version is very complicated. I just want to call for streaming recognize each time I need it rather than having it run as the main continuous loop of my app.

Is there a simple way to do that?

Once my other code is done, it will go back and capture audio, submit it to GRPC and transcribe the results and finish.

The version that records a file and then calls the REST service is not fast enough for near real-time transcription. I need the streaming version.

Activity

  1. jerjou
    self-assigned this
    on Oct 25, 2016
  2. jerjou
    added
    help wantedWe'd love to have community involvement on this issue.
    on Oct 25, 2016
  3. jerjou commented on Oct 25, 2016

    @jerjou
    jerjou
    on Oct 25, 2016
    Contributor
    More actions

    Yes - remember, this is sample code. It's not a library in itself - you should feel free to change it how you see fit.

    Assuming you have interim_results=False, listen_print_loop doesn't need to be a loop, and it doesn't need to print. It could instead return the result once it's finalized (or you could detect END_OF_SPEECH and return an accumulation of results then). Or you could forego the listen_print_loop entirely and simply get the next result by getting the next iterator result - ie result = next(recognize_stream). The main idea is that recognize_stream is just an iterator of responses - you should feel free to do anything you want with them.

    Depending on if you want to keep the connection, or the microphone, open, you might want to exit the cloud_speech.beta_create_Speech_stub or record_audio context managers. If you want them both to close after you get a result, you can just rename the main function to not be the main function, and call it from your real main function (after modifying it to return results, of course).

  4. jerjou
    closed this as completedon Oct 25, 2016
  5. thecloudist commented on Oct 25, 2016

    @thecloudist
    thecloudist
    on Oct 25, 2016
    Author
    More actions

    Cheers. Very helpful.

  6. Linchin
    added a commit that references this issue on Aug 18, 2025

    chore: Update gapic-generator-python to v1.11.2 (#615)

    794ebf2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jerjou
    jerjou

Labels

help wantedWe'd love to have community involvement on this issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.