【发布时间】:2018-09-14 17:45:47
【问题描述】:
我不知道为什么在响应以下代码时收到此错误。
# imports
from google.cloud import texttospeech_v1beta1 as texttospeech
AUDIO_PROCESS_ROOT = 'path_audio'
VEL_NORMAL = 1.0
KEY_API_ROOT = 'path_key'
# set credentials environment
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]=KEY_API_ROOT+"nome.json"
def TextToSpeech(text):
client = texttospeech.TextToSpeechClient()
input_text = texttospeech.types.SynthesisInput(text=text)
voice = texttospeech.types.VoiceSelectionParams(language_code='en-US', name='en-US-Wavenet- B',ssml_gender=texttospeech.enums.SsmlVoiceGender.MALE)
#speaking_rate --> responsavel pela taxa de velocidade no intervalo de [0.25 a 4.0], sendo 1.0 a velocidade normal padrão
audio_config = texttospeech.types.AudioConfig(audio_encoding=texttospeech.enums.AudioEnc oding.MP3, speaking_rate=VEL_NORMAL)
response = client.synthesize_speech(input_text, voice,audio_config)
with open(AUDIO_PROCESS_ROOT+'audio_normal.mp3', 'wb') as out:
out.write(response.audio_content)
TextToSpeech("Hi, how are you")
错误:
RetryError(u'Deadline of 600.0s exceeded while calling '
【问题讨论】:
-
请将错误发布为文本而不是图像
-
好的,我觉得有图片会更好。
-
最好将错误以文本形式发布,以便其他用户可以复制。它还增加了可读性。
-
很好,很有道理,谢谢!
-
您的例外还有更多吗?好像缺少一部分。
标签: python google-app-engine google-cloud-platform text-to-speech