Jarvis is a Python-based, voice-controlled virtual assistant 🧐 that can automate various tasks on your computer. It leverages speech recognition, natural language processing, and APIs to execute commands such as opening apps, controlling media, sending messages, generating essays, and more.
- 🎤 Voice Commands: Use natural speech to control Jarvis.
- 🚀 App Automation: Open applications like WhatsApp, Spotify, Google Chrome, etc.
- 🎵 Media Control: Increase/decrease volume, play music via YouTube or Spotify.
- 📞 Communication: Send messages or make calls on WhatsApp.
- 🔄 Content Generation: Generate essays using AI-based APIs.
- 🌐 Multilingual Support: Supports commands in multiple languages with translation.
- 🔍 Screen OCR: Capture and read WhatsApp messages using OCR (Optical Character Recognition).
- 📰 News Fetching: Retrieve the latest news using the NewsAPI.
Before using Jarvis, you need to install the following libraries:
speech_recognition
pyttsx3
requests
pywhatkit
pyautogui
pytesseract
pillow
win32com.client
(for MS Word integration)platform
(for OS-related functionality)
Install dependencies using pip
:
pip install speech_recognition pyttsx3 requests pywhatkit pyautogui pytesseract pillow pywin32
Additionally, you need to install Tesseract-OCR:
- 🔗 Download Tesseract-OCR from here.
- 🔧 During installation, note the installation directory (default:
C:\Program Files\Tesseract-OCR
). - 🗒 Add the path in the script:
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
Clone this repository to your local machine:
git clone https://github.com/yourusername/jarvis-assistant.git
cd jarvis-assistant
Jarvis uses APIs for various tasks like news fetching and essay generation. Add your keys in the script:
- NewsAPI: Get your API key from NewsAPI.
- AI21 API: Get your API key from AI21 Studio.
Update the placeholders in the script:
NEWS_API_KEY = 'your_news_api_key'
AI21_API_KEY = 'your_ai21_api_key'
Add your contacts in the contacts
dictionary in the script. Example:
contacts = {
"John": "+1234567890",
"Doe": "+0987654321"
}
Ensure your WhatsApp application path is correctly set in the script. Example:
whatsapp_path = r"C:\Users\YourUserName\AppData\Local\WhatsApp\WhatsApp.exe"
Run the script:
python jarvis_assistant.py
Once running, say "Jarvis" to activate it and give your commands. Example commands:
- "open WhatsApp"
- "send message to John Hi there!"
- "play the song Shape of You"
- "news"
- "generate an essay on climate change"
Jarvis will process and execute your commands.
- Activation: Jarvis listens for the keyword "Jarvis" to activate itself.
- Speech Recognition: Converts spoken commands to text using the
speech_recognition
library. - Command Mapping: The text command is mapped to a specific functionality (e.g., sending a WhatsApp message or opening an app).
- Execution: The mapped function is executed via Python libraries and APIs.
- User says: "send message to John Hey, how are you?"
- Jarvis extracts the name "John" and the message "Hey, how are you?".
- It uses the
contacts
dictionary to fetch John's number. - The
pywhatkit
library is used to send the WhatsApp message.
- "open WhatsApp"
- "open Spotify"
- "play the song Believer"
- "increase volume"
- "send message to John Good morning!"
- "news"
- "generate an essay on artificial intelligence"
- "read my WhatsApp messages"
Contributions are always welcome! If you'd like to contribute to the project, follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/<your-feature-name>
- Commit your changes:
git commit -m "Added <feature-name>"
- Push to the branch:
git push origin feature/<your-feature-name>
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.