A web application that helps users learn by generating detailed notes and interactive quizzes from text or YouTube videos using AI. Now includes an AI-powered study chatbot with persistent conversation history and LaTeX/Markdown support.
- Note Generation: Generate comprehensive notes from text input or YouTube video transcripts
- Interactive Quizzes: Automatically create multiple-choice quizzes from generated notes
- AI Study Chatbot: Ask questions about your notes with a context-aware AI assistant. Supports Markdown and LaTeX formatting, and saves your chat history per session.
- User Authentication: Secure user registration and login system (JWT-based)
- Dashboard: Track your learning progress, review past notes, quizzes, and chat sessions
- Delete Chat: Easily clear your chat history for any session
- Responsive Design: Works on both desktop and mobile devices
- Backend: FastAPI (Python)
- Frontend: HTML, CSS, JavaScript (with Jinja2 templating)
- Database: SQLite (via SQLAlchemy, aiosqlite)
- AI/ML: Google Gemini 2.5 Flash model
- Authentication: JWT (JSON Web Tokens)
- Video Processing: YouTubeTranscriptAPI (for YouTube transcription)
- Math/Markdown: MathJax for LaTeX, marked.js for Markdown, highlight.js for code
- Python 3.8+
- Google AI API key
-
Clone the repository:
git clone https://github.com/sheepie20/learnai cd learnai -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the project root and add your Google AI API key and other secrets:SECRET_KEY=your_secret_key GOOGLE_API_KEY=your_google_api_key MAIL_USERNAME=your_email MAIL_PASSWORD=your_email_app_password MAIL_FROM=your_email MAIL_PORT=your_smtp_port MAIL_SERVER=your_smtp_server MAIL_STARTTLS=your_starttls MAIL_SSL_TLS=your_ssl_tls -
Initialize the database:
python -c "from database import engine; import asyncio; from models import init_db; asyncio.run(init_db(engine))"
Start the development server:
uvicorn main:app --reloadThe application will be available at http://localhost:8000
Or... go to https://learnai.sheepie.dev to use it officially.
POST /generate-notes: Generate notes from text or YouTube URLPOST /generate-quiz: Generate a quiz from notesGET /quiz/{quiz_id}: View a specific quizPOST /quiz/{quiz_id}: Submit quiz answersPOST /register: Register a new userPOST /token: Authenticate and get access tokenGET /dashboards: View user's learning dashboardsGET /chat/{quiz_id}: Access the AI study chatbot for a quiz/sessionPOST /api/chat/{quiz_id}: Interact with the AI chatbot (persistent, context-aware)
main.py: Main FastAPI application and route handlersai_service.py: Core AI functionality for note taking, quiz generation, and chatauth.py: Authentication and user managementdatabase.py: Database connection and session managementmodels.py: SQLAlchemy modelsyoutube.py: YouTube video processing utilitiestemplates/: HTML templates (dashboard, quiz, chat, etc.)static/: Static files (CSS, JavaScript, images)
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Google for the powerful Gemini language models
- FastAPI for the awesome web framework
- The open-source community for various libraries and tools used in this project
- MathJax, marked.js, and highlight.js for rich chat and note formatting