importspeech_recognitionassrr=sr.Recognizer()whileTrue:# Initialize the microphone
withsr.Microphone()assource:print("Speak!!: ")audio=r.listen(source)try:# do the transcription
transcription=r.recognize_google(audio,language='en-US')print(transcription)exceptsr.UnknownValueError:print("Didn't understand the audio")exceptsr.RequestError:print("request error")
Top comments (0)