0
当试图使用Python SDK连接到IBM WATSON的Speech-to-Text API并遵循文档here中的示例时,我得到以下错误:当试图连接IBM Watson API时,为什么会出现'Broken pipe'错误?
“ConnectionError:( '连接异常中止',错误(32, '破碎管')),而这样做POST请求URL”
speech_to_text = SpeechToTextV1(
username=os.environ['WATSON_SPEECH_USERNAME'],
password=os.environ['WATSON_SPEECH_PASSWORD'],
x_watson_learning_opt_out=False
)
def speech_to_text_api_call(audio_filename):
with open(audio_filename, 'rb') as a_file:
http_response = speech_to_text.recognize(
a_file,
content_type='audio/wav',
word_alternatives_threshold = 0.5,
word_confidence = True,
timestamps = True,
profanity_filter = False,
smart_formatting = True,
speaker_labels = True,)
return http_response
test = speech_to_text_api_call('temp/test-audio.wav')
我认为SDK是为了管理一个流媒体请求,目前还不清楚为什么我会得到这种性质的错误。欢迎使用解决方案...