在WebAppon Ruby on Rails上工作。我想得到字幕为预先录制的视频,也为新的视频要记录。
我已经实现了gem 'google-cloud-speech'。
但现在我无法获取视频的文本。我从Google Cloud API文档中得到了添加模型的建议,但是当我将model: 'video'添加到配置中时,它告诉我初始化映射条目中没有这样的字段model。
我没有添加模型的代码如下所示。
speech_client = Google::Cloud::Speech.new
config ={ encoding: :LINEAR16,
sample_rate_hertz: 16000,
language_code: "en-US",
}
audio = { uri: @uri }
response = speech.recognize config, audio它给了我类似下面的错误信息。
Google::Gax::RetryError: GaxError Exception occurred in retry method that was not classified as transient, caused by 3:Request contains an invalid argument. from /Users/hiren/.rvm/gems/ruby-2.5.1@Snip/gems/google-gax-1.3.0/lib/google/gax/api_callable.rb:369:in `rescue in block in retryable'
任何帮助都是非常感谢的。
谢谢
发布于 2018-08-23 23:44:39
关于模型问题,这可能是因为video model还不能在V1版本中使用,因为这个特性是v1p1beta1版本的一部分。
关于您的代码问题,我刚刚成功地完成了here显示的示例。如果你附上完整的代码,这将是很有帮助的,因为文档中的代码运行良好。
https://stackoverflow.com/questions/51984168
复制相似问题