Pymitra is a Python-based voice assistant designed to simplify daily tasks through voice commands. It can open websites, play music, provide weather updates, tell jokes, share news, answer AI-based questions, and send WhatsApp messages.
- Web Navigation: Opens YouTube, LinkedIn, Google, and ChatGPT.
- Music Playback: Plays songs from a predefined music library via YouTube links.
- Information Retrieval: Provides current time, date, weather, jokes, and news.
- AI-Powered Q&A: Answers questions using the Mistral-7B model via DeepInfra API.
- WhatsApp Messaging: Sends messages to predefined contacts using WhatsApp Web.
- Voice Interaction: Supports wake word detection ("Pymitra", "Mitra", etc.) and command processing.
- Python 3.8+
- Libraries: Listed in
requirements.txt - APIs:
- OpenWeatherMap (Weather)
- NewsAPI (News)
- DeepInfra (AI Q&A)
- A microphone for voice input
- Clone the repository:
git clone https://github.com/yourusername/pymitra.git
- Navigate to the project directory:
cd pymitra - Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
- Copy
.env.exampleto.env:cp .env.example .env
- Add your API keys to
.env:WEATHER_API_KEY=your_openweathermap_key NEWS_API_KEY=your_newsapi_key DEEPINFRA_TOKEN=your_deepinfra_token
- Copy
- Set up contacts:
- Copy
contacts_item_template.pytocontacts_item.py:cp contacts_item_template.py contacts_item.py
- Edit
contacts_item.pyto add your contacts:contacts = { "Name": "Phone Number" # e.g., "John": "+1234567890" }
- Copy
- Create a
music_library.pyfile:- Add your song names and YouTube links:
music = { "song name": "YouTube URL" # e.g., "thunder": "https://www.youtube.com/watch?v=..." }
- Add your song names and YouTube links:
- Run the main script:
python main.py
- Say the wake word ("Pymitra", "Mitra", etc.) to activate.
- Issue commands like:
- "Open YouTube"
- "Play Shape of You"
- "What's the weather in Mumbai?"
- "Tell me a joke"
- "Send WhatsApp to [Name] saying [Message]"
- "AI, what's the capital of France?"
- Say "close", "exit", or "goodbye" to stop the assistant.
main.py: Core script for wake word detection and command loop.speech_engine.py: Handles text-to-speech (pyttsx3, gTTS) and speech recognition.command_handler.py: Processes commands for web, music, info, and messaging.music_library.py: Contains a dictionary of song names and YouTube links.contacts_item.py: Stores contact names and phone numbers for WhatsApp messaging.requirements.txt: Lists all required Python libraries..gitignore: Excludes sensitive and temporary files..env.example: Template for environment variables.contacts_item_template.py: Template for contact details.
- OpenWeatherMap: Weather data
- NewsAPI: News headlines
- DeepInfra: AI-powered question answering
- Google Speech Recognition: Speech-to-text conversion
- Requires an active internet connection.
- WhatsApp messaging relies on WhatsApp Web and may need manual intervention.
- Music library is limited to predefined songs.
- API keys and contacts must be configured manually.
Feel free to fork the repository, create a feature branch, and submit a pull request. Report issues or suggest features via GitHub Issues.
This project is licensed under the MIT License.