我试着从音频文件中读取文本:
import speech_recognition as sr
# obtain path to "english.wav" in the same folder as this script
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "09.04.01 KMCTC.wav")
# AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "french.aiff")
# AUDIO_FILE = path.join(path.dirname(path.realpath(__file__)), "chinese.flac")
# # use the audio file as the audio source
r = sr.Recognizer()
with sr.AudioFile(AUDIO_FILE) as source:
audio = r.record(source) # read the entire audio file
HOUNDIFY_CLIENT_ID = "qt-kd2mxXrlJO-eZGfvV_A==" # Houndify client IDs are Base64-encoded strings
HOUNDIFY_CLIENT_KEY = "YAeInVWu2yamXAmw8KBVeMpiBA7kvVijysDF0HW-jm9oZA0ip97dH38nOSuQPGG7suxKuZg3MLgdjrVjPB74ZA==" # Houndify client keys are Base64-encoded strings
try:
print("Houndify thinks you said " + r.recognize_houndify(audio, client_id=HOUNDIFY_CLIENT_ID, client_key=HOUNDIFY_CLIENT_KEY))
except sr.UnknownValueError:
print("Houndify could not understand audio")
except sr.RequestError as e:
print("Could not request results from Houndify service; {0}".format(e))我不知道为什么我会犯同样的错误:
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response它是怎么修好的?有什么想法吗?谷歌云,语音和其他服务不工作(问题与API)使用houndify,我至少我可以得到的钥匙和去.
发布于 2022-03-16 06:50:58
如果在长音频文件上也有此错误,则似乎在音频文件上工作<1分钟。这个houndify和wit.ai似乎都是用于类似Alexa样式的简短命令或查询。
https://stackoverflow.com/questions/71475337
复制相似问题