Back to Aws Doc Sdk Examples

Amazon Transcribe code examples for the SDK for Python

python/example_code/transcribe/README.md

latest4.7 KB
Original Source

Amazon Transcribe code examples for the SDK for Python

Overview

Shows how to use the AWS SDK for Python (Boto3) to work with Amazon Transcribe.

<!--custom.overview.start--> <!--custom.overview.end-->

Amazon Transcribe provides transcription services for your audio files and audio streams.

⚠ Important

  • Running this code might result in charges to your AWS account. For more details, see AWS Pricing and Free Tier.
  • Running the tests might result in charges to your AWS account.
  • We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see Grant least privilege.
  • This code is not tested in every AWS Region. For more information, see AWS Regional Services.
<!--custom.important.start--> <!--custom.important.end-->

Code examples

Prerequisites

For prerequisites, see the README in the python folder.

Install the packages required by these examples by running the following in a virtual environment:

python -m pip install -r requirements.txt
<!--custom.prerequisites.start--> <!--custom.prerequisites.end-->

Single actions

Code excerpts that show you how to call individual service functions.

Scenarios

Code examples that show you how to accomplish a specific task by calling multiple functions within the same service.

<!--custom.examples.start--> <!--custom.examples.end-->

Run the examples

Instructions

<!--custom.instructions.start--> <!--custom.instructions.end-->

Create and refine a custom vocabulary

This example shows you how to do the following:

  • Upload an audio file to Amazon S3.
  • Run an Amazon Transcribe job to transcribe the file and get the results.
  • Create and refine a custom vocabulary to improve transcription accuracy.
  • Run jobs with custom vocabularies and get the results.
<!--custom.scenario_prereqs.transcribe_Scenario_CustomVocabulary.start--> <!--custom.scenario_prereqs.transcribe_Scenario_CustomVocabulary.end-->

Start the example by running the following at a command prompt:

python transcribe_basics.py
<!--custom.scenarios.transcribe_Scenario_CustomVocabulary.start-->

This example uses a public domain audio file downloaded from Wikipedia and converted from .ogg to .mp3 format. The file contains a reading of the poem Jabberwocky by Lewis Carroll.

<!--custom.scenarios.transcribe_Scenario_CustomVocabulary.end-->

Transcribe audio and get job data

This example shows you how to do the following:

  • Start a transcription job with Amazon Transcribe.
  • Wait for the job to complete.
  • Get the URI where the transcript is stored.
<!--custom.scenario_prereqs.transcribe_Scenario_GettingStartedTranscriptionJobs.start--> <!--custom.scenario_prereqs.transcribe_Scenario_GettingStartedTranscriptionJobs.end-->

Start the example by running the following at a command prompt:

python getting_started.py
<!--custom.scenarios.transcribe_Scenario_GettingStartedTranscriptionJobs.start--> <!--custom.scenarios.transcribe_Scenario_GettingStartedTranscriptionJobs.end-->

Tests

⚠ Running tests might result in charges to your AWS account.

To find instructions for running these tests, see the README in the python folder.

<!--custom.tests.start--> <!--custom.tests.end-->

Additional resources

<!--custom.resources.start--> <!--custom.resources.end-->

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0