Created
June 25, 2020 16:50
-
-
Save yegorkryukov/b76b39c36bd926184dfb73d3fcc20295 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def start_transcribe_job(transcribe, job_name, bucket, file): | |
"""Starts an AWS Transcribe job | |
Parameters | |
---------- | |
transcribe : AWS `transcribe` service client instance | |
job_name : str, name of the AWS job | |
bucket : str, AWS S3 bucket name | |
file : str, name of the mp3 file to transcribe | |
Returns | |
------- | |
True: if job started successfully | |
""" | |
# this is the location of your mp3 file | |
file_uri = f'https://s3.amazonaws.com/{bucket}/{file}' | |
# try launching the job and return any error messages | |
try: | |
transcribe.start_transcription_job( | |
TranscriptionJobName=job_name, | |
Media={'MediaFileUri': file_uri}, | |
MediaFormat='mp3', | |
LanguageCode='en-US') | |
return True | |
except Exception as e: | |
return e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment