Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions auth.cfg.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[watson]
username = UUID
password = pass
iam_apikey = "Place your api key here"
url = "Place the url provided on the credentials page here"
18 changes: 9 additions & 9 deletions watson-transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
# under the License.

import argparse
import ConfigParser
import configparser
import json
from os.path import join, dirname
from watson_developer_cloud import SpeechToTextV1


def get_auth():
config = ConfigParser.RawConfigParser()
config = configparser.RawConfigParser()
config.read('auth.cfg')
user = config.get('watson', 'username')
password = config.get('watson', 'password')
return (user, password)
iam_apikey = config.get('watson', 'iam_apikey')
url = config.get('watson', 'url')
return (iam_apikey, url)


def parse_args():
Expand All @@ -41,9 +41,9 @@ def main():
args = parse_args()
(user, passwd) = get_auth()
speech_to_text = SpeechToTextV1(
username=user,
password=passwd,
x_watson_learning_opt_out=False
iam_apikey=user,
url=passwd,

)

speech_to_text.get_model('en-US_BroadbandModel')
Expand All @@ -59,7 +59,7 @@ def main():
word_confidence=True)
with open("watson-transcript.json", "w") as out:
print("Transcription done, written to watson-transcription.json")
out.write(json.dumps(output, indent=2))
out.write(json.dumps(output.get_result(), indent=2))

if __name__ == "__main__":
main()