![]() This project is licensed under the Apache-2.0 License. # Instantiate our handler and start processing events handler = MyEventHandler( stream. Stream, reader, BYTES_PER_SAMPLE, SAMPLE_RATE, CHANNEL_NUMS # NOTE: For pre-recorded files longer than 5 minutes, the sent audio # chunks should be rate limited to match the realtime bitrate of the # audio stream to avoid signing issues. # Start transcription to generate our async stream stream = await client. # Setup up our client with our chosen AWS region client = TranscribeStreamingClient( region = REGION) # This handler can be implemented to handle transcriptions as needed. """ SAMPLE_RATE = 16000 BYTES_PER_SAMPLE = 2 CHANNEL_NUMS = 1 # An example file can be found at tests/integration/assets/test.wav AUDIO_PATH = "tests/integration/assets/test.wav" CHUNK_SIZE = 1024 * 8 REGION = "us-west-2" class MyEventHandler( TranscriptResultStreamHandler):Īsync def handle_transcript_event( self, transcript_event: TranscriptEvent): This handler will simply print the text out to your interpreter. utils import apply_realtime_delay """ Here's an example of a custom event handler you can extend to process the returned transcription results as needed. model import TranscriptEvent from amazon_transcribe. handlers import TranscriptResultStreamHandler from amazon_transcribe. client import TranscribeStreamingClient from amazon_transcribe. # It's not a dependency of the project but can be installed # with `pip install aiofile`. Import asyncio # This example uses aiofile for asynchronous file reads. On the audio input requirements can be found in the Amazon Transcribe Streaming Setup for this SDK will require either live or prerecorded audio. Usage, check the following developer guides: ![]() ![]() Configure the profile in ~/.aws/credentialsįor more details on the AWS shared configuration file and credential provider.Set the AWS_PROFILE pointing to your AWS profile directory.Set the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and optionally the. ![]() The SDK to successfully resolve your API keys: In essence you'll need one of these authentication configurations setup in order for If you don't already have local credentials setup for your AWS account, you can follow Non-standard operating systems may need to compile these ( awscrt) as precompiled wheels for common platforms Using the Amazon Transcribe API, you can analyze audio files stored in Amazon S3 and have the service return a text file of the transcribed speech. To use from your Python application, add amazon-transcribe as a dependency in your requirements.txt file.ĪWS Common Runtime (CRT), a collection ofĬ libraries we interact with through bindings. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |