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

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

StartSpeechSynthesisTask

下面的 Python 代码示例使用Amazon SDK for Python (Boto)以在您账户内的本地指定的区域中列出词典Amazon配置。有关创建配置文件的信息,请参阅 步骤 3.1:设置 Amazon Command Line Interface (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)