【发布时间】:2024-01-21 02:35:01
【问题描述】:
我正在尝试对使用 python 3.x、jupyter notebook 和 SpeechRecognition 库的一些音频文件执行语音识别,但我得到:
'RequestError: missing google-api-python-client module: ensure that google-api-python-client is set up correctly.'
在使用识别谷歌云时,即使我已经安装它并在运行时看到“google-api-python-client”
conda list
使用默认的 google 语音 API 密钥时一切顺利。
使用的代码如下:
import speech_recognition as sr
r = sr.Recognizer()
with open('file_with_keys.json') as f:
GOOGLE_CLOUD_SPEECH_CREDENTIALS = f.read()
test_audio = sr.AudioFile('audio_file.wav')
with test_audio as source:
audio = r.record(source)
r.recognize_google_cloud(audio, language = 'es-MX',
credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS)
预期结果包括我当前文件的转录。
非常感谢。
【问题讨论】:
标签: python jupyter-notebook speech-recognition google-cloud-speech