This is a Python-based personal assistant which can process user voice and perform various tasks based on the user's input.
The personal assistant can perform the following tasks based on user's voice input:
- Open a website on the internet (e.g., "Hey open website"), It will open the website in system default web browser.
- Play audio (e.g., "Play audio"), It ill play music randomly from the directories configured in configuration.csv
- Tell the current time (e.g., "What is the time"), It will inform you the current time.
- Launch a specified application (e.g., "Start appname"), it will start the application installed in the machine.
- Send an email to a specific contact (e.g., "Send email to contactname"), It will send email to correspondence email of the contact name configured in contact.csv
- Quit the program (e.g., "Quit"), It will quite the program
To use the personal assistant, follow these steps:
Clone the repository and install the necessary dependencies (python modules). Run the personal_assistant.py script using a Python interpreter. Speak your command to the personal assistant and it will perform the task accordingly.
- configuration_encrypted.csv
-
Step-1
Update below information in configuration.csv
Name
Email
Password
audio
-
Step-2
generate configuration_encrypted.csv by encrypting the configuration.csv
you can follow these steps:
Import the necessary modules:
from cryptography.fernet import Fernet
Generate a new Fernet key:
key = Fernet.generate_key()
Save the key to a file:
with open('key.key', 'wb') as key_file:
key_file.write(key)
Load the key from the file:
with open('key.key', 'rb') as key_file:
key = key_file.read()
Initialize a Fernet object using the key:
fernet = Fernet(key)
Read the contents of the file configuration.csv:
with open('configuration.csv', 'rb') as file:
original = file.read()
Encrypt the file contents:
encrypted = fernet.encrypt(original)
Write the encrypted data to a new file:
with open('configuration_encrypted.csv', 'wb') as encrypted_file:
encrypted_file.write(encrypted)
Note that the Fernet module uses symmetric encryption, meaning that the same key is used for both encryption and decryption. Therefore, you will need to keep the key file safe and secure in order to be able to decrypt the file later.
-
Step-3
Remove configuration.csv:
-
- contacts.csv
Update the contacts.csv with name and correspondence email address.
At the end, root folder should have below files;
- main.py (python program)
- key.key (generated in step-2 of above step)
- configuration_encrypted.csv (generated in step-2 of above step)
- contacts.csv (updated in above step)
from cryptography.fernet import Fernet
- Decrypting the email id password and other user details from configuration_encrypted.csv.import datetime
- To check current timefrom time import sleep
- To manage sleepfrom pyttsx3 import init
- To use sapi and its properties to get list of installed voicesfrom speech_recognition import Recognizer, Microphone
- To use voice engine to recognize voicefrom webbrowser import open
- To access browserfrom os import listdir, startfile, path
- To use system propertiesfrom random import randint
- To generate random numberfrom subprocess import Popen, PIPE, STDOUT
- To run window commandsfrom smtplib import SMTP
- To access SMTP to send emailsfrom email.mime.text import MIMEText
- To format so can use subject, etc
Contributions to this repo are welcome. If you find a bug or have a suggestion for improvement, please open an issue on the repository. If you would like to make changes to the code, feel free to submit a pull request.
This personal assistant is a basic implementation and may not have the full functionality of a commercial product. Use it at your own risk.