You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
audio = r.listen(source)
try:
command = r.recognize_google(audio).lower()
print("You said: " + command)
except sr.UnknownValueError:
print("Sorry, I did not understand that.")
command = take_command()
return command
import pyttsx3
def speak(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
def process_command(command):
if "hello" in command:
speak("Hello! How can I assist you?")
elif "bye" in command:
speak("Goodbye!")
exit()
else:
speak("I'm not sure how to respond to that.")
while True:
command = take_command()
process_command(command)
The text was updated successfully, but these errors were encountered:
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
audio = r.listen(source)
try:
command = r.recognize_google(audio).lower()
print("You said: " + command)
except sr.UnknownValueError:
print("Sorry, I did not understand that.")
command = take_command()
return command
import pyttsx3
def speak(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
def process_command(command):
if "hello" in command:
speak("Hello! How can I assist you?")
elif "bye" in command:
speak("Goodbye!")
exit()
else:
speak("I'm not sure how to respond to that.")
while True:
command = take_command()
process_command(command)
import speech_recognition as sr
def take_command():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
audio = r.listen(source)
import pyttsx3
def speak(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
def process_command(command):
if "hello" in command:
speak("Hello! How can I assist you?")
elif "bye" in command:
speak("Goodbye!")
exit()
else:
speak("I'm not sure how to respond to that.")
while True:
command = take_command()
process_command(command)
The text was updated successfully, but these errors were encountered: