[英]How to import IBM Bluemix Watson speech-to-text in Choregraphe?
[英]How to use Speech to text and Text to Speech APIs from IBM Bluemix in Python
我現有的代碼是:
import requests
import json
import os
url = "https://stream.watsonplatform.net/speech-to-text-beta/api/v1/recognize"
username= "USERNAME"
password= "PASSWORD"
filepath = '/home/user/myfamily.ogg' # path to file
filename = os.path.basename(filepath)
audio = open(filepath,'rb')
files_input = {
"audioFile":(filename,audio,'audio/ogg')
}
response = requests.post(url, auth=(username, password), headers={"Content-Type": "audio/wav"},files=files_input)
print('stauts_code: {} (reason: {})'.format(response.status_code, response.reason))
print response.text
但是,我收到以下錯誤:stauts_code:405(原因:不允許使用方法)
{
"error": "Your browser approached me (at /text-to-speech/api) with the method \"POST\". I only allow the methods HEAD, GET here.",
"code": 405,
"code_description": "Method Not Allowed"
}
我正在使用.ogg文件作為音頻輸入。
您正在使用的網址( https://stream.watsonplatform.net/speech-to-text-beta/api/v1/recognize
)不再有效,請注意-beta
,它很久以前就已棄用。 你從哪里得到的?
您能否使用以下網址: https://stream.watsonplatform.net/speech-to-text/api/v1/recognize
: https://stream.watsonplatform.net/speech-to-text/api/v1/recognize
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.