nvidia-riva / python-clients

Riva Python client API and CLI utils
MIT License
63 stars 22 forks source link

using the streaming_response_generator #19

Closed Goddard closed 1 year ago

Goddard commented 1 year ago

I am attempting to use the streaming_response_generator in a websocket. How does one use this with a websocket where the data is coming in isn't an iterator?

PeganovAnton commented 1 year ago

Hi @messiaen! Sorry for late response.

A streaming_response_generator() can take any iterable of audio chunks. It is not necessary an iterator.

If you get a huge chunk of audio as input, then you may split it. This repo provides ways тo split audio from files and a microphone.

Goddard commented 1 year ago

I think you meant me, but let me elaborate. A websocket receives a raw audio stream. This is just raw audio data and it is only "bytes". It has no iterator itself. If you try to pass just bytes you get an error. I eventually found a solution using nodejs instead of python, but it would still be cool to see how to get this working using python.

PeganovAnton commented 1 year ago

@Goddard If receive your audio in a chunk of bytes, then it will be simpler to use ASRService.offline_recognize(). If you still need streaming, then you will need to write some kind of wrapper to make it work.

virajkarandikar commented 1 year ago

Closing issue due to lack of activity. Please re-open the issue if you would like to follow up with this issue.