Skip to content

Harshit057/aitutor

Repository files navigation

๐Ÿค– AI Tutor - Personal Learning Assistant

A modern, interactive AI tutor that combines conversational AI with specialized educational features - completely local and privacy-focused!

Python Flask License Maintenance

๐ŸŒŸ Key Highlights

  • ๐Ÿ”’ 100% Private: All processing happens locally - your data never leaves your computer
  • ๐Ÿ’ฐ Zero Cost: No API fees or subscriptions required
  • ๐ŸŽ“ Educational Focus: Specialized for learning with 8+ subjects and 30+ quiz questions

๐Ÿš€ Quick Start

Option 1: Instant Start (Recommended)

  1. Double-click start_ai_tutor.bat in the project folder
  2. Open your browser and navigate to http://localhost:5000
  3. Start learning! ๐ŸŽ‰

Option 2: Manual Start

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py

# Open in browser: http://localhost:5000

Option 3: With Local LLM (ChatGPT-like)

For enhanced conversational AI capabilities:

  1. Install Ollama (recommended):

    # Download from https://ollama.ai
    ollama pull llama3.2  # or llama2, mistral, etc.
    ollama serve
  2. Start AI Tutor:

    python app.py
  3. Enjoy enhanced conversations with full ChatGPT-like functionality!

๐Ÿ“– Need help with LLM setup? Check out LLM_SETUP_GUIDE.md for detailed instructions.

โœจ Features

๐Ÿค– Hybrid AI Intelligence

  • Local LLM Integration: Connect with Ollama, llama.cpp, or any OpenAI-compatible API
  • Built-in Expertise: Specialized educational knowledge for precise academic responses
  • Smart Routing: Automatically selects the best AI system for each type of question
  • Fallback System: Works perfectly even without external LLM connections

๐ŸŽ“ Educational Excellence

  • ๐Ÿ“š Comprehensive Subjects: 8 major areas including Math, Science, History, and more
  • ๐ŸŽฏ Intelligent Quizzes: 30+ carefully crafted questions with multiple difficulty levels
  • ๐Ÿงฎ Math Calculator: Step-by-step solutions for arithmetic and word problems
  • ๐Ÿค” Common Sense Q&A: Practical knowledge about everyday topics
  • ๐Ÿ“ Study Assistance: Homework help and concept explanations

๐ŸŽจ Modern User Experience

  • ๐Ÿ’ฌ Real-time Chat: Instant responses with typing indicators
  • ๐Ÿ”Š Voice Support: Toggle text-to-speech for audio learning
  • ๐Ÿ“ฑ Responsive Design: Perfect experience on desktop, tablet, and mobile
  • ๐ŸŽจ Beautiful Interface: Modern gradient design with smooth animations
  • โšก Fast Performance: Optimized for quick responses and smooth interactions

๐Ÿ”ง Technical Features

  • ๐Ÿ Python Backend: Built with Flask for reliability and scalability
  • ๐Ÿง  NLP Processing: Optional spaCy integration for advanced text analysis
  • ๐ŸŒ HTTP API Ready: Easy integration with any LLM service
  • ๏ฟฝ Session Management: Maintains context during conversations
  • ๐Ÿ”’ Privacy First: All data stays on your machine

Open in browser: http://localhost:5000


### **Option 3: With Local LLM (ChatGPT-like)**
For enhanced conversational AI capabilities:

1. **Install Ollama** (recommended):
   ```bash
   # Download from https://ollama.ai
   ollama pull llama3.2  # or llama2, mistral, etc.
   ollama serve
  1. Start AI Tutor:

    python app.py
  2. Enjoy enhanced conversations with full ChatGPT-like functionality!

๏ฟฝ๏ธ Tech Stack

Component Technology Purpose
Backend Python 3.7+ Core application logic
Web Framework Flask 2.3+ HTTP server and routing
NLP spaCy (optional) Natural language processing
TTS pyttsx3 Text-to-speech functionality
HTTP Client requests LLM API communication
Frontend HTML5, CSS3, JavaScript Modern responsive UI
Data JSON Knowledge base storage

๐Ÿ’ฌ Usage Examples

Educational Queries

๐Ÿง‘ "Explain photosynthesis"
๐Ÿค– Detailed explanation with examples and key concepts

๐Ÿง‘ "Quiz me on mathematics easy"
๐Ÿค– Interactive quiz with step-by-step solutions

๐Ÿง‘ "What is 25 ร— 4 + 10?"
๐Ÿค– 110. Here's how I calculated it: (25 ร— 4 = 100) + 10 = 110

Conversational AI (with LLM)

๐Ÿง‘ "Write a poem about coding"
๐Ÿค– Creative poem about programming and technology

๐Ÿง‘ "Explain quantum computing like I'm 10"
๐Ÿค– Simple, engaging explanation with analogies

๐Ÿง‘ "Help me brainstorm app ideas"
๐Ÿค– Creative suggestions with detailed descriptions

Study Assistance

๐Ÿง‘ "Help me understand Newton's laws"
๐Ÿค– Comprehensive explanation with real-world examples

๐Ÿง‘ "Common sense: Why do things fall down?"
๐Ÿค– Simple explanation of gravity suitable for all ages

๐Ÿ“ Project Structure

aitutor/
โ”œโ”€โ”€ ๐Ÿ“„ app.py                  # Main Flask application
โ”œโ”€โ”€ ๐Ÿ“„ main.py                 # Command-line interface
โ”œโ”€โ”€ ๐Ÿ“„ config.py               # Configuration settings
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt        # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ start_ai_tutor.bat      # Windows quick-start script
โ”œโ”€โ”€ ๐Ÿ“„ question_answering.py   # Advanced Q&A processing
โ”œโ”€โ”€ ๐Ÿ“ data/
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ content.json        # Educational knowledge base
โ”œโ”€โ”€ ๐Ÿ“ templates/
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ index.html          # Modern web interface
โ””โ”€โ”€ ๐Ÿ“ __pycache__/            # Python cache files

๐Ÿ”ง Installation & Setup

Prerequisites

  • Python 3.7 or higher
  • pip (Python package manager)
  • Modern web browser

Detailed Installation

  1. Clone the repository:

    git clone https://github.com/Harshit057/aitutor.git
    cd aitutor
  2. Install Python dependencies:

    pip install -r requirements.txt
  3. [Optional] Install spaCy for enhanced NLP:

    pip install spacy
    python -m spacy download en_core_web_sm
  4. [Optional] Set up local LLM:

    • Ollama (recommended): Follow instructions at https://ollama.ai
    • llama.cpp: Set up local server
    • Other: Any OpenAI-compatible API endpoint
  5. Run the application:

    python app.py
  6. Access the interface: Open your browser and navigate to http://localhost:5000

๐ŸŽฏ AI Tutor vs. Alternatives

Feature AI Tutor ChatGPT Plus Khan Academy Wolfram Alpha
Privacy โœ… 100% Local โŒ Cloud-based โŒ Cloud-based โŒ Cloud-based
Cost โœ… Free Forever โŒ $20/month โœ… Free/Premium โŒ Subscription
Offline Use โœ… Yes โŒ No โŒ No โŒ No
Educational Focus โœ… Specialized โš ๏ธ General โœ… Specialized โœ… Math Focus
Voice Support โœ… Built-in โŒ Separate App โŒ Limited โŒ No
Quizzes โœ… Interactive โŒ No โœ… Yes โŒ No
Math Solver โœ… Step-by-step โš ๏ธ Text-based โœ… Yes โœ… Advanced
Customization โœ… Full Control โŒ Limited โŒ No โŒ No

๐ŸŽ“ Perfect For

  • Students (middle school to university)
  • Self-learners exploring science and technology
  • Parents helping with children's homework
  • Teachers using interactive classroom tools
  • Privacy-conscious users keeping data local
  • Budget-conscious learners avoiding subscription fees
  • Offline learners in areas with limited internet

๐Ÿ”ฎ Roadmap & Future Features

Upcoming Enhancements

  • User authentication and progress tracking
  • More interactive learning modules
  • Advanced quiz analytics
  • Multi-language support
  • Mobile app development
  • Integration with more LLM providers
  • Collaborative learning features
  • Advanced visualization tools

Long-term Vision

  • Personalized learning paths
  • AI-generated practice problems
  • Integration with educational platforms
  • Voice-first learning experience
  • Advanced assessment tools

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes: Add features, fix bugs, improve documentation
  4. Test thoroughly: Ensure everything works as expected
  5. Commit changes: git commit -m 'Add amazing feature'
  6. Push to branch: git push origin feature/amazing-feature
  7. Submit pull request: Describe your changes clearly

Development Guidelines

  • Follow PEP 8 coding standards
  • Add comments for complex logic
  • Update documentation for new features
  • Test with and without LLM integration
  • Ensure mobile responsiveness

๐Ÿ› Troubleshooting

Common Issues

App won't start:

# Check Python version
python --version

# Reinstall dependencies
pip install -r requirements.txt --upgrade

# Check for port conflicts
netstat -ano | findstr :5000

TTS not working:

  • Ensure pyttsx3 is installed correctly
  • Check system audio settings
  • Try toggling voice on/off in the interface

LLM connection issues:

  • Verify LLM server is running
  • Check firewall settings
  • Review LLM_SETUP_GUIDE.md

spaCy model missing:

python -m spacy download en_core_web_sm

Getting Help

  • ๐Ÿ“– Check LLM_SETUP_GUIDE.md for detailed setup instructions
  • ๐Ÿ’ฌ Open an issue on GitHub for bugs or questions
  • ๐Ÿ“ง Contact the maintainers for urgent issues

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • spaCy: Advanced natural language processing
  • Flask: Lightweight and powerful web framework
  • pyttsx3: Cross-platform text-to-speech library
  • Ollama: Making local LLMs accessible
  • The open-source community: For continuous inspiration and support

โญ Star this project if you find it helpful!

Report Bug โ€ข Request Feature โ€ข Contribute

Made with โค๏ธ for learners everywhere

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors