MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / takeCommand

Function takeCommand

projects/JARVIS.PY/JARVIS2.0.py:36–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35
36def takeCommand():
37 # Function to listen to user's voice input and return the recognized text
38 r = sr.Recognizer()
39 with sr.Microphone() as source:
40 print("Listening...")
41 r.pause_threshold = 1
42 audio = r.listen(source)
43
44 try:
45 print("Recognizing...")
46 query = r.recognize_google(audio, language="en-in")
47 print(f"User said: {query}\n")
48
49 except Exception as e:
50 # If speech recognition fails, prompt the user to repeat the command
51 print("Could you please repeat it, sir...")
52 return "None"
53 return query
54
55
56def sendEmail(to, content):

Callers 1

JARVIS2.0.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected