0

在此处输入图像描述

有时我得到这个错误有时我没有它来来去去,有没有办法解决?我在代码的某个地方犯了错误吗?

def audio():
    r = sr.Recognizer()
    with sr.Microphone() as source:
        r.adjust_for_ambient_noise(source, duration=1)
        audio = r.listen(source)
        said = ''

        try:
            said = r.recognize_google(audio)
            print(said)
        except Exception as e:
            print('expection: ' + str(e))
    return said.lower()

text = audio()
`
4

0 回答 0