Jarvis is a Python-based voice assistant that can perform various tasks such as opening websites, playing music, reading news headlines, and answering questions using AI. It uses speech recognition to listen for commands and text-to-speech to respond.
- Voice activation using the wake word "Jarvis"
- Opens popular websites (Google, Facebook, YouTube, LinkedIn)
- Plays music from a predefined library
- Reads top news headlines
- Answers questions and performs tasks using OpenAI's GPT-3.5 model
- Text-to-speech functionality for responses
Before you begin, ensure you have met the following requirements:
- Python 3.6+
- pip (Python package manager)
- A microphone connected to your computer
- Clone this repository:
git clone https://github.com/yourusername/jarvis-voice-assistant.git
- Navigate to the project directory:
cd jarvis-voice-assistant
- Install the required packages:
pip install -r requirements.txt
Before running the assistant, you need to set up the following:
- OpenAI API Key: Replace
"sk-proj-ruhZLbxKEyDCY4CPtc1jT3BlbkFJqcf8ppZ5Vvj0BZDD1T68"
with your actual OpenAI API key. - News API Key: Replace
"6e7540f473254def9e9b8be4e7717f94"
with your actual News API key from NewsAPI.org. - Music Library: Update the
musicLibrary.py
file with your preferred music tracks and their corresponding URLs.
Run the script:
python jarvis_assistant.py
- Wait for Jarvis to initialize.
- Say "Jarvis" to activate the assistant.
- After Jarvis responds with "Ya", speak your command or question.
- "Open Google/Facebook/YouTube/LinkedIn": Opens the respective website.
- "Play [song name]": Plays the specified song from your music library.
- "News": Reads out the latest news headlines.
- Any other command or question will be processed by the AI model.
- SpeechRecognition: For converting speech to text.
- pyttsx3: For text-to-speech conversion.
- gTTS: Google Text-to-Speech API for alternative speech output.
- pygame: For playing audio files.
- requests: For making HTTP requests to the News API.
- openai: For interacting with OpenAI's GPT models.
- Python Speech Recognition Tutorial
- OpenAI API Documentation
- NewsAPI Documentation
- Pygame Documentation
- Text-to-Speech in Python
- If you encounter issues with speech recognition, ensure your microphone is properly connected and configured.
- For OpenAI API errors, check that your API key is correct and you have sufficient credits.
- If news headlines are not being read, verify your News API key and internet connection.
Contributions, issues, and feature requests are welcome. Feel free to check the issues page if you want to contribute.
This project is licensed under the MIT License - see the LICENSE file for details.
This project uses various APIs and services. Ensure you comply with their respective terms of service. The authors are not responsible for any misuse or violations.