My code is pretty simple. It runs long_running_recognize on a single channel FLAC audio file and stores the result using the Google Cloud Speech API. I'm trying to find a way to get the current progress of the long_running_recognize operation. I found some documentation on the topic but I'm having trouble making any sense of it.
client = speech.SpeechClient()
operation = client.long_running_recognize(
audio = speech.types.RecognitionAudio(
uri = str('gs://speech-clips/'+self.audio_fqid),
),
config = speech.types.RecognitionConfig(
encoding = enums.RecognitionConfig.AudioEncoding.FLAC,
sample_rate_hertz = sample_rate,
enable_word_time_offsets = True,
language_code = 'en-US',
),
)
response = operation.result()
Here is some of the documentation I found:
- https://cloud.google.com/speech/reference/rest/v1/LongRunningRecognizeMetadata
- https://cloud.google.com/speech/reference/rpc/google.longrunning#google.longrunning.Operations.GetOperation
- https://cloud.google.com/speech/reference/rest/v1beta1/operations
Any help will be greatly appreciated.