Hỏi đáp

Chia sẻ kiến thức, cùng nhau phát triển

giúp mình với ạ!

19:37 26-12-2023 709 lượt xem 1 bình luận

Code:

import speech_recognition

robot_ear = speech_recognition.Recognizer()
with speech_recognition.Microphone() as mic:
    print("Robot: I'm Listening")
    audio = robot_ear.listen(Microphone)
try:
    you = robot_ear.recognizer_google(audio)
except:
    you == ""

print("You: " + you)

Lỗi:
Traceback (most recent call last):
  File "C:\Users\admin\Documents\hieuhieu\nghe.py", line 4, in <module>
    with speech_recognition.Microphone() as mic:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\speech_recognition\__init__.py", line 87, in __init__
    device_info = audio.get_device_info_by_index(device_index) if device_index is not None else audio.get_default_input_device_info()
                                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyaudio\__init__.py", line 812, in get_default_input_device_info
    device_index = pa.get_default_input_device()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: No Default Input Device Available

Bình luận

Để bình luận, bạn cần đăng nhập bằng tài khoản Howkteam.

Đăng nhập
Vo Tan Duc đã bình luận 12:04 28-12-2023

Bạn debug để tìm lỗi ở dòng nào nha

Câu hỏi mới nhất