Jarvis my first python project
import pyttsx3
import datetime
import speech_recognition as sr
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
print(voices)
engine.setProperty('voice', voices[0].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
def wishMe():
hour = int(datetime.datetime.now().hour)
if hour>=0 and hour<12:
speak("Good morning")
elif hour>12 and hour<18:
speak("Good afternoon")
speak("I am jarvis how can i help you sir")
else:
speak("Good evening")
speak("I am jarvis how can I help you sir")
def takeCommand():
r = sr.Recognizer()
with sr.Microphone as source:
print("Listening...")
if __name__ == "__main__":
speak("aditya")
wishMe()
Comments
Post a Comment