Google语音API开发人员错误

时间:2018-01-11 08:10:06

标签: python api cloud speech

在编写我制作的10s wav文件之前,我编写了代码(基本上与同步here下的python代码相同)。就在今天它停止工作,我得到这个错误:
Traceback (most recent call last): File "/home/ishan/Google_Cloudspeech_on_pepper/cloudspeechtest.py", line 35, in <module> response = client.recognize(config, audio) File "/usr/local/lib/python2.7/dist-packages/google/cloud/gapic/speech/v1/speech_client.py", line 201, in recognize return self._recognize(request, options) File "/usr/local/lib/python2.7/dist-packages/google/gax/api_callable.py", line 452, in inner return api_caller(api_call, this_settings, request) File "/usr/local/lib/python2.7/dist-packages/google/gax/api_callable.py", line 438, in base_caller return api_call(*args) File "/usr/local/lib/python2.7/dist-packages/google/gax/api_callable.py", line 376, in inner return a_func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/google/gax/retry.py", line 127, in inner ' classified as transient', exception) google.gax.errors.RetryError: RetryError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with (StatusCode.RESOURCE_EXHAUSTED, Quota exceeded.)>)

以下是代码:

import io
from os import path

# Imports the Google Cloud client library
from google.cloud import speech
# from google.cloud import datastore #dont need this
from google.cloud.speech import enums
from google.cloud.speech import types

#client = datastore.Client()

GOOGLE_APPLICATION_CREDENTIALS = path.join(
    path.dirname(__file__),
    'ishan_sr.json')

# Instantiates a client
client = speech.SpeechClient()

# The name of the audio file to transcribe
file_name = path.join(
    path.dirname(__file__),
    'Fish.wav')

# Loads the audio into memory
with io.open(file_name, 'rb') as audio_file:
    content = audio_file.read()
    audio = types.RecognitionAudio(content=content)

config = types.RecognitionConfig(
    encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
    sample_rate_hertz=44100,
    language_code='en-US')

# Detects speech in the audio file
response = client.recognize(config, audio)

for result in response.results:
    print('Transcript: {}'.format(result.alternatives[0].transcript))

我几周没有发送请求,我在Google云仪表板中的使用情况显示我的配额未使用。代码也停止了我的另一个帐户,所以我认为这是Google的错误,或者我需要更新某些内容?

0 个答案:

没有答案
相关问题