Created
May 25, 2021 12:33
-
-
Save KaushikShresth07/a8235f39cc4ff99e8ac774a586268dfc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import speech_recognition as sr | |
def TakeCommand(): | |
r = sr.Recognizer() | |
with sr.Microphone() as source: | |
print(": Listening....") | |
r.pause_threshold = 1 | |
audio = r.listen(source) | |
try: | |
print(": Recognizing...") | |
query = r.recognize_google(audio,language='en-in') | |
print(f": Your Command : {query}\n") | |
except: | |
return "" | |
return query.lower() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment