Project J.A.R.V.I.S
Copy from Here:::
import pyttsx3 #pip install pyttsx3
import speech_recognition as sr #pip install speechRecognition
import datetime
import wikipedia #pip install wikipedia
import webbrowser
import os
import smtplib
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
# print(voices[1].id)
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!")
else:
speak("Good Evening!")
speak("I am Jarvis Sir. Please tell me how may I help you")
def takeCommand():
#It takes microphone input from the user and returns string output
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:
# print(e)
print("Say that again please...")
return "None"
return query
if __name__ == "__main__":
wishMe()
while True:
query = takeCommand().lower()
# Logic for executing tasks based on query
if 'wikipedia' in query:
speak('Searching Wikipedia...')
query = query.replace("wikipedia", "")
results = wikipedia.summary(query, sentences=2)
speak("According to Wikipedia")
print(results)
speak(results)
elif 'open youtube' in query:
webbrowser.open("youtube.com")
elif 'open google' in query:
webbrowser.open("google.com")
elif 'open stackoverflow' in query:
webbrowser.open("stackoverflow.com")
elif 'play music' in query:
music_dir = 'G:\\kishan all.co\\d\\songs'
songs = os.listdir(music_dir)
print(songs)
os.startfile(os.path.join(music_dir, songs[0]))
elif 'the time' in query:
strTime = datetime.datetime.now().strftime("%H:%M:%S")
speak(f"Sir, the time is {strTime}")
elif 'open code' in query:
codePath = "C:\\Users\\kishancjx\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
os.startfile(codePath)
#you should enter your path here
elif 'email to ' in query:
try:
speak("What should I say?")
content = takeCommand()
to = "YourfriendEmail@gmail.com"
sendEmail(to, content)
speak("Email has been sent!")
except Exception as e:
print(e)
speak("Sorry my friend. I am not able to send this email")
ThankU...
What we write that only it said it not recognize automatically
ReplyDeleteyes bro install pyaudio
DeleteTo install pyaudio type in the terminal as pip install pipwin and click enjoying enter and after that type in the terminal pipwin install pyaudio
Deleteyeah
DeleteIt needs pyaudio module buddy
ReplyDeleteYeah
DeleteThank you so much for your great explanation for each line of code
ReplyDeletei want spiderman's edith smart glass ai assistant
ReplyDeleteme too bro
Deletebro i cannot use pyaudio it is saying error what should i do
ReplyDeletetry to install pipwin
Deletenext pipwin install pyaudio
Hay bro I like your you tube channel vedios and you created me now I am a learner of life I learned Manny think about computer science I am inspired about you you said was that write bro .see bro in future in will be a gratest person like black you and Elon musk and I am santhosh
Deletebro pyaudio error it shows pyaudio is not installed when running the program i can get the commands like good morning sir how can i help you after that it is not executing and shows the above error pls reply anna
ReplyDeleteType in the terminal pip install pipwin and click enter and now type in the terminal pipwin install pyaudio. Hope It helps you
DeleteSupper
ReplyDeleteits keep on listening..... and not recognising pls help me out...
ReplyDeleteYou should not have background noises
DeleteBro in program it shows no voice
ReplyDeleteHow to get voice bro
install pyaudio
DeleteYou should install pyaudio but this might not help installing pyaudio to get voice you should type in the terminal as pip install pyttsx3
DeleteBro yanaku from _ctypes import COMError
ReplyDeletebro how to install pytts3 in visual studio 2019 bro ... plz help me out
ReplyDeletePip install pyttsx3
DeleteOr open unofficial binaries of python and download pyttsx3 from there these are the two remedies for your problem
First you have to save the file so press ctrl+s and save it as jarvis.py and after that type in the terminal as pip install pyttsx3.Hope it helps
Deletehow to reduce the time of jarvis to recognize because in mine it takes too much
ReplyDeleteR.pause threshold = 1.Put it to one so it takes only a little time to recognize
ReplyDeleteyeah
ReplyDeletebro pls say how to install pyaudio
ReplyDeleteI want to communicate with you i tried many ways please give me as instagram id
ReplyDeleteHay bro I like your you tube channel vedios and you created me now I am a learner of life I learned Manny think about computer science I am inspired about you you said was that write bro .see bro in future in will be a gratest person like black you and Elon musk and I am iron Man
ReplyDeleteMy name is santhosh
ReplyDeleteBro enaku No module error pyttsx3
ReplyDeleteVeruthu solution solluga
Bro voice pesa matenkuthu
ReplyDeletebro what was the front end, backend and software details , pls share bro
ReplyDelete