Python Project : Iron Man Jarvis AI Desktop Voice Assistant | Python For Absolute Beginners in 2021

Python Project : Iron Man Jarvis AI Desktop Voice Assistant | Python For Absolute Beginners in 2021
Python Project: Iron Man Jarvis AI Desktop Voice Assistant | Python For Absolute Beginners in 2021

Python Project: Iron Man Jarvis AI Desktop Voice Assistant | Python For Absolute Beginners in 2021


Python Jarvis AI Project Function Details: A python Jarvis is the best AI project. you can every task performed on this  AI python program.

What can this A.I. assistant do for you?

Task: Like 
1. Play Music.
2. Open youtube.
3. Open chrome.
4. Open google.
5. Open Gmail.
6. Open Wikipedia.

You can use the Jarvis AI program in python.

import pyttsx3
import datetime
import wikipedia
import webbrowser
import os
from speech_recognition import Microphone
import speech_recognition as sr
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
# print(voices[0].id)
engine.setProperty('voice', voices[1].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 sir")
    elif hour >= 12 and hour < 18:
        speak("Good Afternoon sir")
    else:
        speak("Good evening sir")
speak("hello How may help you")
def takecommad():
    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:
    while 1:
        query=takecommad().lower()
        if 'wikipedia' in query:
            speak('Searching Wikipedia...')
            query=query.replace("wikipedia","")
            result=wikipedia.summary(query,sentences=2)
            speak("Acorording To Wikipedia")
            print(result)
            speak(result)
        elif 'open youtube' in query:
            webbrowser.open("youtube.com")
        elif 'open google' in query:
            webbrowser.open("google.com")
        elif 'open gmail' in query:
            webbrowser.open("gmail.com")
        elif 'open chrome' in query:
            webbrowser.open("chrome")
        elif 'play music' in query:
            music_dir='D:\RAVI DATA\(R) MUSIC'
            song=os.listdir(music_dir)
            print(song)
            os.startfile(os.path.join(music_dir,song[0]))


Post a Comment

0 Comments