Skip to content

Commit f0c3231

Browse files
committed
adding get_model to speech to text
1 parent 056644a commit f0c3231

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

examples/speech_to_text_v1.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
print(json.dumps(speech_to_text.models(), indent=2))
1313

14+
print(json.dumps(speech_to_text.get_model('en-US_BroadbandModel'), indent=2))
15+
1416
with open(join(dirname(__file__), '../resources/speech.wav'), 'rb') as audio_file:
1517
print(json.dumps(speech_to_text.recognize(
1618
audio_file, content_type='audio/wav', timestamps=True), indent=2))

watson_developer_cloud/speech_to_text_v1.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,10 @@ def models(self):
5555
Returns the list of available models to use with recognize
5656
"""
5757
return self.request(method='GET', url='/v1/models', accept_json=True)
58+
59+
def get_model(self, model_id):
60+
"""
61+
:param model_id: The identifier of the desired model
62+
:return: A single instance of a Model object with results for the specified model.
63+
"""
64+
return self.request(method='GET', url='/v1/models/{0}'.format(model_id), accept_json=True)

0 commit comments

Comments
 (0)