Создаю голосового ассистента но столкнулся с проблемой:
код при выполнении выдает ошибку.
Код:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone(device_index=5) as source:
print("Say something...")
audio = r.listen(source)
query = r.recognize_google(audio, language="ru-RU")
print(query.lower())
Лог:
Say something...
Traceback (most recent call last):
File "D:\Proger\Progect School Adv\main.py", line 8, in <module>
query = r.recognize_google(audio, language="ru-RU")
File "C:\Python\lib\site-packages\speech_recognition\__init__.py", line 858, in recognize_google
if not isinstance(actual_result, dict) or len(actual_result.get("alternative", [])) == 0: raise UnknownValueError()
speech_recognition.UnknownValueError