首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Watson speech-to-text API;支持媒体URL?

Watson speech-to-text API;支持媒体URL?
EN

Stack Overflow用户
提问于 2016-04-16 02:50:11
回答 1查看 531关注 0票数 1

目前,Watson的speech-to-text API似乎希望应用程序接口调用将音频上传到Watson服务器。在音频已经存在于云中(例如,在S3上)的情况下,这需要用户下载文件,然后将其重新上传到Watson。

有没有办法在API调用中包含媒体文件的URL?

EN

回答 1

Stack Overflow用户

发布于 2016-04-25 03:05:12

API需要音频,但目前不支持URL文件。

这取决于开发人员下载音频(在您的示例中是从S3)并将其上传到API。

下面的示例从Dropbox获取ogg文件,并将其发送到Speech to Text进行识别。

代码语言:javascript
复制
var watson = require('watson-developer-cloud');
var request = require('request');
var fs = require('fs');

var speechToText = watson.speech_to_text({
  username: 'SERVICE USERNAME',
  password: 'SERVICE PASSWORD',
  version: 'v1',
  url: 'https://stream.watsonplatform.net/speech-to-text/api'
});

var audioFile = 'https://www.dropbox.com/s/l97pe3x996fnbtg/speech.ogg?dl=1';

// create the stream
var recognizeStream = speechToText.createRecognizeStream();

// pipe in some audio
request(audioFile).pipe(recognizeStream);

// and pipe out the transcription
recognizeStream.pipe(fs.createWriteStream('transcription.txt'));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36654786

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档