Хочу сделать распознование речи, но все время вылазит ошибка
Traceback (most recent call last):
File "D:\Documents\python\test.py", line 5, in
audio = r.listen(source)
File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 652, in listen
buffer = source.stream.read(source.CHUNK)
File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\speech_recognition\__init__.py", line 161, in read
return self.pyaudio_stream.read(size, exception_on_overflow=False)
File "C:\Users\anton\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames, exception_on_overflow)
KeyboardInterrupt
Код:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone(device_index=1) as source:
audio = r.listen(source)
query = r.recognize_google(audio, language="ru-RU")
print('you speak: ' + query.lower())
Заранее спасибо.