python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

V1 Speech grpc streaming

Open V3SalC opened this issue 9 years ago • 24 comments

Hi All, I noticed that previous example of grpc speech streaming for v1beta1 is gone now. Will it be updated for v1? I tried to replace the old library with google.cloud.speech.v1 but there looks to be no support for SpeechStub

V3SalC avatar May 05 '17 19:05 V3SalC

So I think you have two issues, which have separate answers:

stream.closed = True doesn't stop the stream

It works for me. Did you add the stream argument to listen_print_loop and pass it in?

single_utterance=True doesn't close stream after first utterance

This appears to be true when using the raw grpc client as well. I filed a bug, but in the meantime, it appears that closing the request stream (eg via stream.closed=True) effectively terminates the connection as well.

jerjou avatar Jul 06 '17 21:07 jerjou

I did add the stream argument, but for some reason, setting closed to True doesn't stop the recognition for me. I have to close the pyaudio stream too: self._audio_stream.close_stream() for the recognition to stop. However, that's perfectly fine for my program.

Thanks for all your help! The sample code was a lifesaver :heart:

thecodingwizard avatar Jul 08 '17 03:07 thecodingwizard

Oh huh - that's unfortunate. It sounds like you're okay for now, but if you'd like to pursue the issue I'm happy to pursue it with you :-) Maybe open a new issue, though, since it's a bit tangential to this one. It'd also be helpful to include the git diff, and the platform that you're running on, just to try to figure out why I wasn't able to reproduce.

jerjou avatar Jul 10 '17 19:07 jerjou

@jerjou @thecodingwizard Hi, does the code above and at https://github.com/GoogleCloudPlatform/python-docs-samples/blob/4c83e78a2f1022738353e960063477f661bc3856/speech/grpc/transcribe_streaming_minute.py#L17 still work for continuing with streaming transcription for however long is needed? I'm not familiar with Python though I may try to convert to Swift.

share9 avatar Nov 27 '18 23:11 share9