Created
May 17, 2019 01:59
-
-
Save thisismattmiller/df35f1c15e623a9d1c471d0c21531fb5 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
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