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 ?