我正在嘗試用於bluemix的語音文本的示例node.js程序。我在api憑證的用戶名和密碼中添加了內容,但是當我運行程序時node.js,我被給了一個Error: Server responded with a non-101 status:403
。有誰知道什麼可能導致這個錯誤?node.js用於bluemix的語音文本示例程序給出403錯誤
下面是示例代碼
'use strict';
var watson = require('watson-developer-cloud');
var fs = require('fs');
var speech_to_text = watson.speech_to_text({
username: '{username}',
password: '{password}',
version: 'v1',
url: 'https://stream.watsonplatform.net/speech-to-text-beta/api'
});
var params = {
content_type: 'audio/wav',
};
// create the stream
var recognizeStream = speech_to_text.createRecognizeStream(params);
// // pipe in some audio
fs.createReadStream(__dirname + '/resources/speech.wav').pipe(recognizeStream);
// // and pipe out the transcription
recognizeStream.pipe(fs.createWriteStream('transcription.txt'));
// listen for 'data' events for just the final text
// listen for 'results' events to get the raw JSON with interim results, timings, etc.
recognizeStream.setEncoding('utf8'); // to get strings instead of Buffers from `data` events
['data', 'results', 'error', 'connection-close'].forEach(function(eventName) {
recognizeStream.on(eventName, console.log.bind(console, eventName + ' event: '));
});
由於
*道歉不附着示例代碼ealier
請出示的代碼,你[R什麼想 –
很難沒有我使用的是內測帳號雖然任何代碼示例 – ianaya89