import speech_recognition as sr
listener = sr.Recognizer()
def takecommand():
try:
with sr.Microphone() as source:
print("Listening...")
voice = listener.listen(source)
command = listener.recognize_whisper(voice)
print(f"You said: {command}")
return command
except Exception as e:
print("Failed to listen. Error:", e)
return None
takecommand()
Trying to run this code but is resulting in Failed to listen. Error: [WinError 126] The specified module could not be found. Error loading "C:\Users\ikabb\AppData\Local\Programs\Python\Python312\Lib\site-packages\torch\lib\caffe2_nvrtc.dll" or one of its dependencies.
It's printing the Listening... thing, but it's not saying anything else other than that error. It should ideally record my audio, recognize it and then return what has been heard. I'm using the Whisper enginge by OpenAI on SpeechRecognition's library. Any idea how I can fix this error? I'm running torch v2.2.0 and torchvision 0.17.1 and I have a Windows PC with an AMD graphics card.
[This may be a dumb question, but I'm fairly new to Python, so yeah, sorry ;-; ]