Skip to content

Instantly share code, notes, and snippets.

@Abhayparashar31
Created December 8, 2020 12:57
Show Gist options
  • Save Abhayparashar31/37f13ccf0685e6845d817891f5996ecb to your computer and use it in GitHub Desktop.
Save Abhayparashar31/37f13ccf0685e6845d817891f5996ecb to your computer and use it in GitHub Desktop.
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
t_end = time.time() + 5
while time.time() < t_end:
print("karl: Listening...")
audio=r.listen(source)
try:
query = r.recognize_google(audio)
print(f"user:{query}")
except"
print("Try Again")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment