How to get the result of a long-running Google Cloud Speech API operation later?
google-cloud-speech, python
Solution
After reading the source, I found that GRPC has a 10 minute timeout. If you submit a large file, transcription can take over 10 minutes. The trick is to use the HTTP backend. The HTTP backend doesn't maintain a connection like GRPC, instead everytime you poll it sends a HTTP request. To use HTTP, do
`speech_client = speech.Client(_use_grpc=False) `
Problem
Below is a snippet that calls the Google Cloud Speech API long running operation to convert an audio file to text ``` from google.cloud import speech speech_client = speech.Client() audio_sample = speech_client.sample( content=None, source_uri=gcs_uri, encoding='FLAC', sample_rate_hertz=44100) operation = audio_sample.long_running_recognize('en-US') retry_count = 100 while retry_count > 0 and not operation.complete: retry_count -= 1 time.sleep(60) operation.poll() ``` However, as it is a long running operation, it could take a while and I ideally don't want to keep the session on while it waits. Is it possible to store some information and retrieve the result later ?