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是爲了管理一個流媒體請求,目前還不清楚爲什麼我會得到這種性質的錯誤。歡迎使用解決方案...