I've a audio stream available as a python generator, and a external endpoint that tells if I've to run google speech streaming recognize on the input audio stream.
Is it possible to consume/destroy all messages until now and proceed to transcribe from this point onwards? Something like this:
while disabled:
time.sleep(30)
for _ in stream:
pass
disabled = check_endpoint()
streaming_transcribe(stream)
答案 0 :(得分:0)
You can generally handle this with a loop on the generator results:
for message in streaming_transcribe(stream):
# Process message
pass
if check_endpoint(): break