繁体   English   中英

当我尝试使用IBM-Watson更改语音到文本的语言时出现错误404

[英]Error 404 when I try to change language for my Speech-to-Text with IBM-Watson

我必须实现一个python程序,我想使用watson-IBM服务。 但我无法更改URL参数中的语言(英语 - >法语)

我已经阅读了这个API文档: https//cloud.ibm.com/docs/services/speech-to-text?topic = speech-to-text-models locale = en

此代码有效(默认语言):

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

但不是这个

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

请查看API文档 - https://cloud.ibm.com/apidocs/speech-to-text?code=python

您具有服务调用的混合服务句柄对象实例。 您显示的代码段是服务句柄对象实例化,网址应该类似于“ https://gateway-lon.watsonplatform.net/speech-to-text/api ”或“ https://gateway-wdc.watsonplatform”。 net / speech-to-text / api '

当您想要转录某些音频时,您使用的方法会在您的情况下recognize这是speech_to_text.recognize(...) 所以从服务文档 -

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

    ).get_result()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM