【发布时间】:2017-08-27 02:17:06
【问题描述】:
我正在运行此处发布的 Google Speech API Python 示例代码:https://googlecloudplatform.github.io/google-cloud-python/stable/speech-usage.html
我要使用异步识别方法(只允许使用 LINEAR16 编码):
导入 Google Cloud 客户端库
from google.cloud import speech
client = speech.Client()
sample = client.sample(source_uri='gs://my-bucket/example.flac',
encoding=speech.Encoding.LINEAR16,
sample_rate=44100)
operation = sample.async_recognize(language_code='es-CL',max_alternatives=2)
retry_count = 100
while retry_count > 0 and not operation.complete:
retry_count -= 1
time.sleep(10)
operation.poll() # API call
operation.complete
for result in operation.results:
for alternative in result.alternatives:
print('=' * 20)
print(alternative.transcript)
print(alternative.confidence)
这是我得到的错误: google.gax.errors.RetryError:GaxError(重试方法发生异常,未归类为瞬态,由 <_rendezvous of rpc flac>)
我该如何解决这个问题?使用同步方法时我没有遇到这个问题。
【问题讨论】: