Jarvis
Jarvis
import pyttsx3
import pywhatkit
import datetime
import wikipedia
import pyjokes
listener = sr.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[1].id)
def talk(text):
engine.say(text)
engine.runAndWait()
def take_command():
try:
print('listening...')
voice = listener.listen(source)
command = listener.recognize_google(voice)
command = command.lower()
if 'jarvis' in command:
print(command)
except:
pass
return command
def run_jarvis():
command = take_command()
print(command)
if 'play' in command:
talk('playing' + song)
pywhatkit.playonyt('song')
print(time)
info = wikipedia.summary(person, 1)
print(info)
talk(info)
talk(pyjokes.get_joke())
run_jarvis()