RoBo Voice Assistant with Python
This is our artificial intelligent virtual assistant(IVA) project in python program. It is also known as intelligent personal assistant(IPA).This project source program works in python integrated development environment(IDE) plateforms that can perform all over tasks or services for an individual based on commands or questions according to user requirements as whatever tasks will perform.
For making this project code to mainly needed
some modules and library they are:-
- pip install pyttsx3.
- pip install speechrecognition.
- pip install pyaudio.
Copy the following source code for project :-
# Robo voice Assistant import pyttsx3 # pip install pyttsx3 import pyaudio import speech_recognition as sr # pip install speechRecognition import datetime import wikipedia # pip install wikipedia import webbrowser import os import cv2 import pywhatkit import random from requests import get import smtplib engine = pyttsx3.init('sapi5') voices = engine.getProperty('voices') # print(voices[0].id) engine.setProperty('voice', voices[0].id) # text to speech def speak(audio): engine.say(audio) engine.runAndWait() # to wish 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("Sir, Welcome to AVH Technology. Please tell me how can I help you") # to convert voice into text 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) x speak("Say that again please...") return "None" return query def sendEmail(to, content): server = smtplib.SMTP('smtp.gmail.com', 587) server.ehlo() server.starttls() server.login('Email Id', 'Passward') # send email from login ID & PD but allow permission less secure apps in gmail account. server.sendmail('Email Id', to, content) server.close() if __name__ == "__main__": wishMe() while True: # if 1: query = takeCommand().lower() # Logic for executing tasks based on query if 'who is' in query: # search wpd speak('Searching Wikipedia...') query = query.replace("wikipedia", "") results = wikipedia.summary(query, sentences=2) speak("According to Wikipedia") print(results) speak(results) elif 'tell me about yourself' in query: speak(f"Sir,My name is Robo. your voice assistance, the current version is 1.0") elif 'robo' in query: speak(f"Yes Sir") elif 'how are you' in query: speak(f"Sir, I am fine and great full of energy")
To be continue.................full source Code
0 Comments