Skip to content

krishnagaud6/jarvis

 
 

Repository files navigation

Keyword-Based News Fetcher

Description

A Python module that fetches the top news articles for a given keyword using NewsAPI.org.
Features:

  • Fetch top 3 news articles (can be changed in script).
  • Display title + URL.
  • Shortens long URLs for cleaner output.
  • Logs fetched news to news_log.txt.
  • Accepts commands like show news about AI.

Usage

  1. Install dependencies:

🤖 Jarvis AI Assistant

Your Personal Voice-Controlled AI Companion

Python Version License: MIT PRs Welcome Stars Forks

Jarvis Logo

A production-ready voice assistant with facial recognition authentication, built on modern Python architecture and web technologies.

FeaturesInstallationUsageDocumentationContributing


✨ Features

🎤 Voice Control 👤 Face Recognition 🔥 Hotword Detection 🌐 Web Integration
Advanced speech-to-text Secure biometric auth Always-on wake word Modern responsive UI

🚀 Core Capabilities

🎯 Voice & AI

  • 🗣️ Real-time Speech Recognition using Google STT
  • 💬 Natural Language Processing with Hugging Face
  • 🎵 Text-to-Speech with customizable voices
  • 🔊 Audio Visualization in real-time
  • 🎙️ Wake Word Detection ("Jarvis", "Alexa")

🔧 Smart Integrations

  • 📱 WhatsApp Automation (messages, calls, video)
  • 🎬 YouTube Control via voice commands
  • 💻 System Control (apps, windows, shortcuts)
  • 📞 Contact Management with voice lookup
  • 🌐 Web Browsing through voice

🛠️ Tech Stack

Backend Technologies

Python OpenCV SQLite NumPy

Frontend Technologies

HTML5 CSS3 JavaScript Bootstrap

AI & ML

Hugging Face TensorFlow

Tools & Libraries

Git VS Code Docker PyPI


🏗️ Architecture

graph TD
    A[🌐 Web Frontend] -->|Eel Bridge| B[🎯 Main Process]
    B --> C[🎤 Speech Recognition]
    B --> D[👤 Face Authentication]
    B --> E[🔥 Hotword Detection]
    C --> F[📝 Command Parser]
    F --> G[⚡ Feature Handlers]
    G --> H[💾 SQLite Database]
    G --> I[📱 WhatsApp Integration]
    G --> J[🎬 YouTube Control]
    G --> K[💬 AI Chatbot]
    
    style A fill:#e1f5ff
    style B fill:#fff3e0
    style G fill:#f3e5f5
    style H fill:#e8f5e9
Loading

📋 Prerequisites

🖥️ System Requirements

OS: Windows 10/11, Linux, macOS
Python: 3.10+
RAM: 4GB minimum
Storage: 500MB free space

🔌 Hardware

Microphone: Required for voice input
Webcam: Required for face recognition
Internet: Active connection needed
Audio Output: Speakers/Headphones

🚀 Installation

📦 Quick Install (Click to expand)

Step 1️⃣: Clone Repository

git clone https://github.com/vannu07/jarvis.git
cd jarvis

Step 2️⃣: Setup Virtual Environment

🪟 Windows

python -m venv venv
venv\Scripts\activate

🐧 Linux/Mac

python3 -m venv venv
source venv/bin/activate

Step 3️⃣: Install Dependencies

pip install -r requirements.txt

Step 4️⃣: Configure Environment

Create a .env file:

# API Keys
HUGGINGFACE_TOKEN=your_token_here
PORCUPINE_ACCESS_KEY=your_key_here

# Voice Settings
TTS_RATE=150
TTS_VOICE=0

# Recognition Settings
FACE_CONFIDENCE_THRESHOLD=50
HOTWORD_SENSITIVITY=0.5

Step 5️⃣: Train Face Recognition (Optional)

python backend/auth/trainer.py

🎬 Quick Start

python run.py

That's it! Jarvis will launch at http://localhost:8000 🚀


💡 Usage

🎤 Voice Commands

🖥️ System Control

Jarvis, open Chrome
Jarvis, launch VS Code
Jarvis, close window
Jarvis, shutdown computer

🎵 Media Control

Jarvis, play Metallica
Jarvis, pause video
Jarvis, next song
Jarvis, volume up

📱 Communication

Jarvis, message John
Jarvis, call Sarah
Jarvis, video call Mike
Jarvis, open WhatsApp

⌨️ Keyboard Shortcuts

Shortcut Action
Win + J (Windows) Manual Activation
Cmd + J (macOS) Manual Activation
Ctrl + Q Quit Application
F11 Fullscreen Toggle

🎯 Wake Words

Say "Jarvis" or "Alexa" followed by your command!


📁 Project Structure

📦 jarvis/
┣ 📂 backend/
┃ ┣ 📂 auth/
┃ ┃ ┣ 📄 haarcascade_frontalface_default.xml
┃ ┃ ┣ 📄 recognize.py        # 👤 Face recognition
┃ ┃ ┣ 📄 trainer.py          # 🎓 Model training
┃ ┃ ┗ 📂 trainer/            # 💾 Trained models
┃ ┣ 📄 command.py            # 🎯 Command parser
┃ ┣ 📄 config.py             # ⚙️ Configuration
┃ ┣ 📄 db.py                 # 💾 Database ops
┃ ┣ 📄 feature.py            # ⚡ Feature handlers
┃ ┗ 📄 helper.py             # 🛠️ Utilities
┣ 📂 frontend/
┃ ┣ 📂 assets/
┃ ┃ ┣ 📂 audio/              # 🔊 Sound files
┃ ┃ ┣ 📂 img/                # 🖼️ Images & icons
┃ ┃ ┗ 📂 vendor/             # 📚 Third-party libs
┃ ┣ 📄 index.html            # 🌐 Main UI
┃ ┣ 📄 style.css             # 🎨 Styles
┃ ┣ 📄 script.js             # ✨ Particle effects
┃ ┣ 📄 main.js               # 🎮 Core logic
┃ ┗ 📄 controller.js         # 🎛️ Event handlers
┣ 📄 main.py                 # 🚀 Entry point
┣ 📄 run.py                  # 🔄 Launcher
┣ 📄 requirements.txt        # 📦 Dependencies
┗ 📄 jarvis.db              # 💾 SQLite DB

🔧 Development

🎨 Adding Custom Commands

1️⃣ Define Command Pattern

Edit backend/command.py:

def parse_command(query: str) -> dict:
    if "my custom action" in query.lower():
        return {
            "action": "custom_action",
            "params": {"param1": "value1"}
        }

2️⃣ Implement Handler

Edit backend/feature.py:

def handle_custom_action(params: dict) -> str:
    # Your implementation here
    result = do_something(params)
    return f"Action completed: {result}"

3️⃣ Register Command

COMMAND_HANDLERS = {
    "custom_action": handle_custom_action,
    # ... other handlers
}
💾 Database Schema
-- 📇 Contacts Table
CREATE TABLE contacts (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    phone TEXT,
    whatsapp TEXT,
    email TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- 💻 Applications Table
CREATE TABLE apps (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    path TEXT NOT NULL,
    keywords TEXT,  -- JSON array
    icon TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- 🌐 Web Commands Table
CREATE TABLE web_commands (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    command TEXT NOT NULL,
    url TEXT NOT NULL,
    description TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
🧪 Testing
# Run all tests
pytest tests/ -v

# Run with coverage
pytest --cov=backend --cov-report=html tests/

# Run specific test file
pytest tests/test_command.py -v

# Linting
black backend/ frontend/ --check
flake8 backend/
pylint backend/
🐳 Docker Deployment
FROM python:3.10-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    portaudio19-dev \
    python3-pyaudio \
    libopencv-dev \
    && rm -rf /var/lib/apt/lists/*

# Copy and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application
COPY . .

EXPOSE 8000

CMD ["python", "run.py"]

Build & Run:

docker build -t jarvis-ai .
docker run -p 8000:8000 -v $(pwd)/jarvis.db:/app/jarvis.db jarvis-ai

📊 Performance Metrics

Metric Value Status
🚀 Cold Start Time ~3.5s
⚡ Response Latency <200ms
🎯 Face Recognition Accuracy 94.2%
💾 Memory Footprint ~150MB
🔋 CPU Usage (Idle) 2-5%

Benchmarked on Windows 11, Intel i5-10400, 16GB RAM


🐛 Troubleshooting

🔴 Common Issues & Solutions

❌ PyAudio Installation Fails

Windows:

pip install pipwin
pipwin install pyaudio

Linux:

sudo apt-get install portaudio19-dev python3-pyaudio
pip install pyaudio

macOS:

brew install portaudio
pip install pyaudio

❌ Face Recognition Not Working

  1. Ensure good lighting conditions
  2. Position face 2-3 feet from camera
  3. Retrain model:
    python backend/auth/trainer.py
  4. Check camera permissions in system settings

❌ Voice Commands Unresponsive

  1. Check microphone permissions
  2. Test microphone:
    python -m speech_recognition
  3. Verify internet connection
  4. Try different microphone device

❌ Module Import Errors

pip install --upgrade --force-reinstall -r requirements.txt

🐞 Enable Debug Mode

# Windows
set JARVIS_DEBUG=1
python run.py

# Linux/Mac
export JARVIS_DEBUG=1
python run.py

🤝 Contributing

We love contributions! 💖

📝 Contribution Guidelines

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch (git checkout -b feature/amazing-feature)
  3. 💾 Commit your changes (git commit -m 'feat: add amazing feature')
  4. 📤 Push to the branch (git push origin feature/amazing-feature)
  5. 🎉 Open a Pull Request

📋 Commit Convention

type(scope): subject

[optional body]

[optional footer]

Types: feat, fix, docs, style, refactor, test, chore

Example:

git commit -m "feat(voice): add support for multiple languages"
git commit -m "fix(face): improve recognition accuracy in low light"
git commit -m "docs(readme): update installation instructions"

🎯 Code Style

  • ✅ Follow PEP 8 for Python code
  • ✅ Use type hints where applicable
  • ✅ Write docstrings for public functions
  • ✅ Run black and flake8 before committing
  • ✅ Add unit tests for new features

🌟 Top Contributors


🗺️ Roadmap

🎯 Short Term

  • 🌍 Multi-language support
  • 📱 Mobile companion app
  • 🎨 Theme customization
  • 🔌 Plugin system

🚀 Medium Term

  • ☁️ Cloud synchronization
  • 🏠 Home automation
  • 🎓 Voice training
  • 📊 Analytics dashboard

💫 Long Term

  • 🤖 Advanced AI models
  • 🌐 Cross-platform support
  • 👥 Multi-user profiles
  • 🔐 End-to-end encryption

📜 License

This project is licensed under the MIT License

License: MIT

See LICENSE file for details


🙏 Acknowledgments

Special thanks to these amazing projects:

OpenCV Google Hugging Face Bootstrap


📞 Contact & Support

Varnit Kumar

GitHub LinkedIn Email

Project Link: github.com/vannu07/jarvis


💖 Show Your Support

If you find this project helpful, please consider:

Starring this repository 🐛 Reporting bugs 💡 Suggesting new features 🤝 Contributing to the code 📢 Sharing with others

Made with ❤️ and Python

Star History Chart


🌟 Don't forget to star this repository!

© 2025 Varnit Kumar. All rights reserved.

>>>>>>> bd1d8cfda59b40748beac88a96cbf5f19c082e32

About

🤖 Jarvis - AI Voice Assistant with Face Recognition | Hacktoberfest 2025 Friendly | Built with Python, OpenCV, and Modern Web Technologies

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 44.1%
  • HTML 31.4%
  • JavaScript 17.7%
  • CSS 6.8%