This non-AI desktop assistant, named Alexa, is built using Python and leverages the SAPI5 text-to-speech engine for vocal responses. Various Python modules are utilized to perform a wide range of tasks, making Alexa a versatile and useful tool for day-to-day activities.
Presented this project at Hack the Mountains 2.0 hackathon and placed in the top 55 teams amongst 300 teams.
-
Graphical User Interface (GUI):
- A user-friendly interface with 'Run' and 'Exit' buttons.
- Clicking 'Run' initiates Alexa, while 'Exit' shuts down the application.
-
Voice Activation and Command Execution:
- Alexa starts in a sleep mode for minimal disruption.
- Activate Alexa by saying "ALEXA WAKE UP".
- Wait for "Alexa is listening..." to be printed on the terminal before issuing any commands.
-
Speech Recognition:
- Alexa uses Google’s API to convert spoken commands into text.
- The recognized text is converted to lowercase to ensure consistent command matching.
-
Command Handling:
- Alexa listens for specific commands and executes predefined tasks if present in the IF-ELSE ladder.
- If an unknown command is issued, Alexa responds with "Sorry, I don't know that".
-
Sleep and Shutdown Commands:
- Say "sleep" to put Alexa back into sleep mode.
- Say "stop" to shut down Alexa.
- Clone this repo into your local machine and open it using VS code or any other editor of your choice.
- Open the terminal and create a virtual environment using the command "python -m venv yourenvname".
- Activate the virtual env created using the command "yourenvname\Scripts\activate".
IMP: Python version to be used is 3.9
- Once activated, install all the packages using the command "pip install -r requirements.txt".
- Once all packages are installed create a .env file with the following vars
VSCODE_LOCATION= (Location of Code.exe in your PC)
WEATHER_API_KEY= (Get it from https://openweathermap.org/api)
NEWS_API_KEY= (Get it from https://newsapi.org/)
EMAIL= (Email ID you want to send email from)
SECRET_KEY= (App Password of the email. Steps to get this given below)
RECEIVER_WHATSAPP_NUMBER= (Number whom you want to send the whatsapp message. Format: 91 Number)
WHATSAPP_MESSAGE= (Whatsapp message you want to send)
TIME_IN_24_HRS= (Time in hrs at which you to send the message. Eg: "21")
TIME_IN_MINS= (Time in mins at which you to send the message. Eg: "30". So message will be sent at 09:30pm)
- Now you are ready to run the application. Type 'py alexa.py' in the terminal and hit enter.
- A GUI created using pyqt5 will open. Clicking on the run button starts alexa.
- Just say 'Alexa wake up' and your desktop assistant is ready to perform the tasks you ask to do it.
-
Greeting Functions
- Who are you?
- How are you?
- Are you single?
- Do you love me?
-
Basic questions
- What is the time?
- Today's date
- A Joke (Using pyjokes module)
- Weather in any place (Using openweathermap API)
- Current location (Using https://get.geojs.io/)
- Internet speed (Using speedtest module)
- IP address (Using https://api.ipify.org)
-
Tasks to be done on a browser
- Play songs on youtube (Using pywhatkit module's playonyt fn)
- Open youtube (Using webbrowser module)
- Open google
- Open stack overflow
-
Fetching Data
- Who is ____? Eg: Who is MS DHoni? (Using wikipedia module)
- Information on wikipedia. Eg: MS Dhoni Wikipedia
- Top 5 News headlines (Fetches from http://newsapi.org)
- Read any page of a particular pdf (PDF needs to be saved inside files folder and specified in pdf_reader function)
-
Control applications in windows (Using os module)
- Open visual studio code
- Close visual studio code
- Open command prompt
- Open camera
- Open notepad
- Close notepad
-
Automate social networks
- Send email to a particular person
- Using SMTPlib module.
- Expects to enter the mail ID of the person you want to send the email and the message
- Send whatsapp message
- Using pywhatkit's module sendwhatmsg fn.
- Expects to be logged into your whatsapp on whatsapp web
- Check someone's Instagram profile and download profile picture
- Using webbrower module & downloads picture using instaloader module.
- Expects to enter the username
- Tweet a tweet
- Using script inside files/self_tweet.py which uses selenium for automation.
- Expects your twitter credentials in files/twitter_info.txt and the message you want to tweet in the terminal.
- Unfortunately, now with additional secruity measures imposed the script fails at 2 step authentication as it expects the OTP to be entered.
- Send email to a particular person
-
Basic window functions
- Switch the window (Using pyautogui module)
- Take a screenshot (Using pyautogui module)
- Hides all files in the current directory (Using os module)
- Unhide those hidden files (Using os module)
- Check battery percentage (Using psutil module)
-
Control volume of the system (Using pyautogui module)
- Volume up
- Volume down
- Mute and unmute
-
Control power options of system (Using os module)
- Shut down the system
- Restart the system
- Put the system into sleep
-
Other functions
- Simple Mathematical calculations (Expects the expression. Eg: 2 2)
- Wish someone on thier birthday with thier picture turned into a sketch
pyinstaller --onefile alexa.py
Exe file with alexa as name could be found in dist folder