Created
March 17, 2017 20:40
-
-
Save santiagobasulto/bc0e4c2c29ae8086e775a4d666fdbd60 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| """Sample code to use the IBM Watson Speech to Text API. | |
| See more at https://blog.rmotr.com. | |
| """ | |
| import json | |
| from watson_developer_cloud import SpeechToTextV1 | |
| IBM_USERNAME = "<YOUR-USERNAME>" | |
| IBM_PASSWORD = "<YOUR-PASSWORD>" | |
| stt = SpeechToTextV1(username=IBM_USERNAME, password=IBM_PASSWORD) | |
| audio_file = open("audio_file.flac", "rb") | |
| with open('transcript_result.json', 'w') as fp: | |
| result = stt.recognize(audio_file, content_type="audio/x-flac", | |
| continuous=True, timestamps=False, | |
| max_alternatives=1) | |
| json.dump(result, fp, indent=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment