我在Python

时间:2016-10-18 00:19:23

标签: python api

我正在开发一个在python中使用语音识别的项目,我正在查看一些示例代码,我想知道使用哪个API密钥以及它看起来像什么。

def callback(recognizer, audio):
# received audio data, now we'll recognize it using Google Speech Recognition
try:
    # for testing purposes, we're just using the default API key
    # to use another API key, use `r.recognize_google(audio, key="GOOGLE_SPEECH_RECOGNITION_API_KEY")`
    # instead of `r.recognize_google(audio)`
    print(recognizer.recognize_google(audio)) <-- right there
except sr.UnknownValueError:
    pass
except sr.RequestError as e:
    pass

我有一个谷歌开发者帐户。请帮忙。谢谢!

1 个答案:

答案 0 :(得分:0)

在此处Google Cloud Speech API创建一个帐户。您可以通过免费帐户获得有限数量的api请求。 要获得完整的文档,请访问https://cloud.google.com/speech/docs/rest-tutorial