import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone as source:
print("Say something")
audio = r.listen(source)
voice_data = r.recognize_google(audio)
print(voice_data)
I am trying to compiling this code but it gives error like this :-
Exception has occurred: AttributeError
__enter__
File "C:\Users\admin\Desktop\text to speech\speech to text.py", line 5, in
<module>
with sr.Microphone as source: