Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisismattmiller/df35f1c15e623a9d1c471d0c21531fb5 to your computer and use it in GitHub Desktop.
Save thisismattmiller/df35f1c15e623a9d1c471d0c21531fb5 to your computer and use it in GitHub Desktop.
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