StartSpeechSynthesisTask - Amazon Polly
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

StartSpeechSynthesisTask

Amazon SDK for Python (Boto) 以下 Python 代码示例使用列出您账户中位于本地 Amazon 配置中指定区域的词典。有关创建配置文件的信息,请参阅 设置 Amazon CLI

有关更多信息,请参阅 StartSpeechSynthesisTask API 参考。

import boto3 import time polly_client = boto3.Session( aws_access_key_id='', aws_secret_access_key='', region_name='eu-west-2').client('polly') response = polly_client.start_speech_synthesis_task(VoiceId='Joanna', OutputS3BucketName='synth-books-buckets', OutputS3KeyPrefix='key', OutputFormat='mp3', Text='This is a sample text to be synthesized.', Engine='neural') taskId = response['SynthesisTask']['TaskId'] print( "Task id is {} ".format(taskId)) task_status = polly_client.get_speech_synthesis_task(TaskId = taskId) print(task_status)