Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import subprocess
import time
import json
with open('file_list_100.txt') as fin:
for line in fin:
line = line.strip().replace('\n','')
json_send = (
""
"{"
f'"TranscriptionJobName": "{line}", '
'"LanguageCode": "en-US", '
'"MediaFormat": "mp3", '
'"Media": {'
f'"MediaFileUri": "https://s3.amazonaws.com/lc-gov-audio/converted/{line}"'
"}"
"}"
)
to_json = json.loads(json_send)
print(json.dumps(to_json,indent=2))
json.dump(to_json,open('transcribe.json','w'))
process = subprocess.Popen("aws transcribe start-transcription-job --region us-east-1 --cli-input-json file://transcribe.json", shell=True, stdout=subprocess.PIPE)
process.wait()
print(process.returncode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment