Jarvis A.I

 J.A.R.V.I.S---

To be honest I use this program in my P.C 
I Have used the following modules,,,,
"
datetime
wikipedia
pyttsx3
webbrowser
speech_recognition
"
If we apply machine learning algorithm,,, then this will be a successful jarvis ai;
import datetime
import wikipedia
import pyttsx3
import speech_recognition as sr
import webbrowser

engin = pyttsx3.init("sapi5")
voice = engin.getProperty('voices')
engin.setProperty('voice', voice[0].id)


def speak(audio):
engin.say(audio)
engin.runAndWait() # without this command, speech will not be audioble

def wishme():
speak("hello sir")
hour = int(datetime.datetime.now().hour)
if hour >= 0 and hour < 12:
speak("Good Morning!")

elif hour >= 12 and hour < 18:
speak("Good Afternoon")

else:
speak("Good Evening")
speak("What can I do for you sir?")
def takeCommand():
# awaz sunega mera AI
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"user said:{query}\n")
except Exception as e:
return "None"
return query



wishme()
while True:
query = takeCommand().lower()

if "wikipedia" in query:
speak('searching in wikipedia...')
query = query.replace("wikipedia", "")
results = wikipedia.summary(query, sentences=2)
print(results)
speak(results)

elif 'open youtube' in query:
webbrowser.open("youtube.com")
speak("opening youtube")

elif 'open google' in query:
webbrowser.open("google.com")
speak("opening google")
elif 'open instagram' in query:
webbrowser.open('https://www.instagram.com/husen_zhare')
speak("opening instagram")

elif 'open gmail' in query:
webbrowser.open("mail.google.com")
speak("opening gmail by google")

elif 'who are you' in query:
speak("I am JARVIS an AI system i was built by sir husen")

elif 'play songs' in query:
webbrowser.open('gaana.com')

elif 'coding channel' in query:
webbrowser.open('youtube.com/c/CodeWithHarry')
speak("Code with harry is best youtube coding channel")

elif 'the time' in query:
strTime = datetime.datetime.now().strftime("%H:%M:%S")
speak(f"sir now its {strTime}")

elif "say hi to ammi" in query:
speak("hi ammi how are you")

elif 'goodbye' in query:
speak(" ok Good bye sir")
break

elif 'who are you' in query:
speak("I ma jaravi naam tho suna hi hoga na meri jaan")

Post a Comment

0 Comments