Skip to content

Jarvis - A sophisticated voice-controlled personal assistant with facial recognition security and modern web interface.

License

Notifications You must be signed in to change notification settings

Lusan-sapkota/Jarvis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Jarvis AI Assistant

Jarvis Logo

A sophisticated voice-controlled personal assistant with facial recognition security and modern web interface.

GitHub license Python Version Platform

Note: This project is actively developed with weekly feature updates and improvements.

Facial Recognition Jarvis Interface Voice Commands

๐Ÿ“‹ Features

  • Secure Facial Authentication

    • Personalized user recognition
    • Multiple user profiles support
    • Secure login system
    • Privacy-focused with local processing
  • Advanced Voice Command System

    • Natural language processing
    • Customizable command library
    • Contextual responses
    • Multilingual support
  • Intelligent Hotword Activation

    • Responds to "Jarvis" wake word
    • Configurable sensitivity
    • Background noise filtering
  • Elegant Web Interface

    • Modern responsive design
    • Real-time visual feedback
    • Chat history and interaction logging
    • Dark/light theme options
  • System Automation

    • Control compatible smart home devices
    • Schedule tasks and reminders
    • File and web search capabilities
    • Calendar integration

๐Ÿ–ฅ๏ธ System Requirements

  • Hardware:

    • Webcam (720p+ recommended)
    • Microphone
    • Speakers/Headphones
    • 4GB+ RAM recommended
    • 500MB free disk space
  • Software:

    • Python 3.6 or higher
    • Modern web browser (Chrome/Firefox recommended)
    • OpenCV with face recognition support
    • Internet connection for web searches and updates

๐ŸŒ Platform Compatibility

Platform Status Notes
Linux โœ… Full support Thoroughly tested on Ubuntu 20.04+ and Debian 10+
Windows โš ๏ธ Partial support Works on Windows 10/11, may require camera configuration adjustments
macOS โš ๏ธ Limited testing Basic functionality works on macOS 11+ (Big Sur)

Note: Currently primarily tested and optimized for Linux environments. Cross-platform improvements are ongoing.

๐Ÿ“ฅ Installation

Prerequisites

Ensure you have Python 3.6+ and pip installed:

python --version
pip --version

Step 1: Clone the repository

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

Step 2: Install dependencies

For Linux:

bash install.sh

For Windows:

pip install -r requirements-windows.txt

For macOS:

pip install -r requirements-mac.txt

Step 3: Configure environment

Create a .env file in the root directory:

# API Keys
OPENAI_API_KEY=your_openai_key_here
WEATHER_API_KEY=your_weather_api_key_here

# Configuration
DEBUG_MODE=False
LOG_LEVEL=INFO
CAMERA_INDEX=0
MIC_INDEX=0

๐Ÿ” Facial Recognition Setup

Step 1: Capture Face Samples

python backend/auth/sample.py

During this process:

  • You'll be prompted for a numeric user ID
  • Enter your name when prompted or add it to the names list
  • The script will capture 100 images of your face
  • Look at the camera from different angles for better recognition
  • Press ESC to exit early if needed

Step 2: Train the Recognition Model

python backend/auth/trainer.py

This will:

  • Process your face samples
  • Create a trainer.yml file
  • Save the model in the trainer directory
  • Optimize recognition parameters for your hardware

๐Ÿš€ Running the Application

Start the main application:

python app.py

The application will:

  1. Initialize all services
  2. Open a browser window with the Jarvis UI
  3. Perform facial authentication
  4. If authenticated, display the main interface
  5. Begin listening for the "Jarvis" hotword
  6. Process commands through voice or text input

๐Ÿ’ฌ Voice Commands

Example commands you can use:

  • "Jarvis, what's the weather today?"
  • "Jarvis, set a timer for 5 minutes"
  • "Jarvis, play some music"
  • "Jarvis, search for Python tutorials"
  • "Jarvis, tell me a joke"
  • "Jarvis, turn on the living room lights"
  • "Jarvis, what's on my calendar today?"
  • "Jarvis, send an email to John"

๐Ÿ”ง Troubleshooting

Face Recognition Issues

If face authentication isn't working:

# Verify the trainer file exists
ls -l backend/auth/trainer/trainer.yml

# Rebuild your training data in better lighting
python backend/auth/sample.py
python backend/auth/trainer.py

# Test recognition separately
python backend/auth/test_recognition.py

Camera Problems

If the camera doesn't work:

# Check camera permissions on Linux
ls -l /dev/video*

# Ensure no other application is using the camera
sudo fuser -v /dev/video0

# Try different camera indices in your .env file
CAMERA_INDEX=1

The application tries multiple camera backends:

  • cv2.CAP_ANY
  • cv2.CAP_V4L
  • cv2.CAP_V4L2
  • cv2.CAP_DSHOW (Windows)
  • cv2.CAP_AVFOUNDATION (macOS)

Audio Issues

If voice recognition isn't working:

# Check audio input devices
python -c "import pyaudio; p = pyaudio.PyAudio(); [print(p.get_device_info_by_index(i)) for i in range(p.get_device_count())]"

# Test microphone
python backend/tests/test_audio.py

# Try different microphone indices in your .env file
MIC_INDEX=1

๐Ÿง  Developer Notes

Project Structure

jarvis/
โ”œโ”€โ”€ app.py                 # Main application entry point
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ auth/              # Authentication modules
โ”‚   โ”‚   โ”œโ”€โ”€ sample.py      # Captures face samples
โ”‚   โ”‚   โ”œโ”€โ”€ trainer.py     # Creates face recognition model
โ”‚   โ”‚   โ””โ”€โ”€ recognize.py   # Authenticates users
โ”‚   โ”œโ”€โ”€ command.py         # Command processing
โ”‚   โ”œโ”€โ”€ feature.py         # Core assistant features
โ”‚   โ”œโ”€โ”€ nlp/               # Natural language processing
โ”‚   โ”‚   โ”œโ”€โ”€ intent.py      # Intent recognition
โ”‚   โ”‚   โ””โ”€โ”€ entity.py      # Entity extraction
โ”‚   โ””โ”€โ”€ utils/             # Utility functions
โ”‚       โ”œโ”€โ”€ audio.py       # Audio processing
โ”‚       โ”œโ”€โ”€ camera.py      # Camera handling
โ”‚       โ””โ”€โ”€ network.py     # Network operations
โ”œโ”€โ”€ frontend/              # Web interface files
โ”‚   โ”œโ”€โ”€ index.html         # Main UI
โ”‚   โ”œโ”€โ”€ styles/            # CSS files
โ”‚   โ”‚   โ”œโ”€โ”€ main.css       # Main stylesheet
โ”‚   โ”‚   โ””โ”€โ”€ themes/        # Theme variations
โ”‚   โ”œโ”€โ”€ scripts/           # JavaScript files
โ”‚   โ”‚   โ”œโ”€โ”€ main.js        # Core functionality
โ”‚   โ”‚   โ”œโ”€โ”€ voice.js       # Voice processing
โ”‚   โ”‚   โ””โ”€โ”€ ui.js          # UI interactions
โ”‚   โ””โ”€โ”€ assets/            # Images, icons, etc.
โ”‚       โ”œโ”€โ”€ img/           # Images
โ”‚       โ”œโ”€โ”€ icons/         # UI icons
โ”‚       โ””โ”€โ”€ sounds/        # Audio cues
โ”œโ”€โ”€ data/                  # Data storage
โ”‚   โ”œโ”€โ”€ faces/             # Face samples
โ”‚   โ”œโ”€โ”€ users/             # User profiles
โ”‚   โ””โ”€โ”€ logs/              # Application logs
โ””โ”€โ”€ tests/                 # Test modules
    โ”œโ”€โ”€ test_auth.py       # Authentication tests
    โ”œโ”€โ”€ test_commands.py   # Command tests
    โ””โ”€โ”€ test_features.py   # Feature tests

Adding Features

To add new commands:

  1. Update the process_command function in app.py:
def process_command(command):
    # ... existing code ...
    elif "your new command" in command:
        return your_new_function()
    # ... existing code ...
  1. Add new functions in the feature.py file:
def your_new_function():
    # Implementation
    return "Response to the user"
  1. Add tests for your new feature:
# tests/test_features.py
def test_your_new_function():
    result = your_new_function()
    assert result == "Expected response"

๐Ÿ“Š Performance Optimization

For better performance on resource-constrained systems:

# Run in lightweight mode
python app.py --lightweight

# Disable unnecessary features
python app.py --no-gui  # Terminal mode
python app.py --no-hotword  # Disable always-listening mode

๐Ÿ”„ Updates and Maintenance

To update Jarvis to the latest version:

git pull origin main
pip install -r requirements.txt
python migrate.py  # Apply any database migrations

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
  3. Commit your changes:
    git commit -m 'Add some amazing feature'
  4. Push to the branch:
    git push origin feature/amazing-feature
  5. Open a Pull Request

Please ensure your code follows the project's coding style and includes appropriate tests.

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Thanks in advance to all contributors and testers
  • Special thanks to the OpenCV and Python communities
  • All the open-source libraries that made this project possible

๐Ÿ”ฎ Roadmap (Maybe in future)

  • Mobile application support
  • Cloud sync for user preferences
  • Advanced NLP for more natural conversations
  • Integration with additional smart home platforms
  • Offline mode for privacy-focused users

About

Jarvis - A sophisticated voice-controlled personal assistant with facial recognition security and modern web interface.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published