0

I have to realize a python program and I would like to use watson-IBM services. But I can not change the language in the parameters of the URL (English --> French)

I already read this API doc: https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-models&locale=en

This code works (default language):

speech_to_text = SpeechToTextV1(
    iam_apikey='blablablablabla <3',
    url='https://gateway-lon.watsonplatform.net/speech-to-text/api')

but not this one

speech_to_text = SpeechToTextV1(
    iam_apikey='blablablablabla <3',
    url='https://gateway-lon.watsonplatform.net/speech-to-text/api/v1/recognize?model=fr-FR_BroadbandModel')
petezurich
  • 9,280
  • 9
  • 43
  • 57
Jeremy.l71
  • 45
  • 7

1 Answers1

0

Please check the API documentation - https://cloud.ibm.com/apidocs/speech-to-text?code=python

You have mixed service handle object instantiation with the service invocation. The snippet you show is the service handle object instantiation and the url should be something like 'https://gateway-lon.watsonplatform.net/speech-to-text/api' or 'https://gateway-wdc.watsonplatform.net/speech-to-text/api'

When you want to transcribe some audio you use the method recognize in your case this would be speech_to_text.recognize(...). So from the service documentation -

speech_recognition_results = speech_to_text.recognize(
        audio=audio_file,
        model='fr-FR_BroadbandModel'

    ).get_result()
chughts
  • 4,210
  • 2
  • 14
  • 27