Skip to content

About

An AI notebook that eats PDFs, DOCX, URLs and YouTube transcripts, then turns them into mind maps, reports, flashcards, quizzes and slide decks.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

SourcebookLM

An AI-powered interactive notebook application that helps you create, organize, and analyze content from various sources. SourcebookLM combines document processing, AI-generated insights, and interactive learning tools to transform your documents, URLs, and YouTube videos into structured knowledge.

Features

  • Multi-Source Content Ingestion

    • Upload and extract text from PDF, DOCX, DOC, TXT, MD, CSV, and LOG files
    • Extract content from web URLs
    • Download and process YouTube video transcripts
  • AI-Powered Tools

    • Chat: Interactive AI assistant with context awareness
    • Mind Maps: Generate hierarchical mind maps from your content
    • Reports: Create structured reports with executive summaries and findings
    • Flashcards: Generate educational flashcards for studying
    • Quiz: Create multiple-choice quizzes with explanations
    • Slides: Generate presentation slide decks
  • Notebook Management

    • Create and organize multiple notebooks
    • Save and load notebook states
    • Persistent storage with MongoDB
    • Track sources and conversation history

Prerequisites

  • Python 3.8 or higher
  • MongoDB database (local or cloud-based like MongoDB Atlas)
  • Google Gemini API key

Installation

  1. Clone the repository

    git clone https://github.com/truepushkar/SourcebookLM.git
    cd SourcebookLM
  2. Create a virtual environment (recommended)

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Set up environment variables

    Create a .env file in the root directory based on sample.env:

    cp sample.env .env

    Edit .env and add your credentials:

    MONGO_URI=mongodb://localhost:27017/  # Or your MongoDB Atlas connection string
    GEMINI_API_KEY=your_gemini_api_key_here
    

Configuration

MongoDB Setup

  • Local MongoDB: Install MongoDB locally and use mongodb://localhost:27017/
  • MongoDB Atlas: Create a free cluster at mongodb.com/cloud/atlas and use the provided connection string

Gemini API Key

  1. Visit Google AI Studio
  2. Create a new API key
  3. Add it to your .env file

Usage

  1. Start the application

    python app.py
  2. Access the application

    Open your web browser and navigate to:

    http://localhost:5000
    
  3. Create a notebook

    • Click "New Notebook" from the dashboard
    • Add sources by uploading files, entering URLs, or YouTube video links
    • Use the AI tools to analyze and transform your content
  4. Interact with your content

    • Chat with the AI about your sources
    • Generate mind maps to visualize concepts
    • Create reports and summaries
    • Build flashcards for study sessions
    • Generate quizzes to test your knowledge

Project Structure

SourcebookLM/
├── app.py                 # Main Flask application
├── generative.py          # AI/Gemini integration
├── upload_text.py         # Document and content extraction
├── requirements.txt       # Python dependencies
├── sample.env            # Environment variables template
├── templates/            # HTML templates
│   ├── dashboard.html    # Main dashboard
│   └── notebook.html     # Notebook interface
└── static/              # Static assets
    ├── styles.css       # Stylesheets
    ├── app.js          # Main application logic
    ├── dashboard.js    # Dashboard functionality
    ├── mindmap.js      # Mind map visualization
    ├── report.js       # Report generation
    ├── flashcards.js   # Flashcard interface
    └── quiz.js         # Quiz functionality

API Endpoints

Notebook Management

  • GET /api/notebooks - List all notebooks
  • POST /api/notebooks - Create or update a notebook
  • GET /api/notebooks/<id> - Load a specific notebook
  • DELETE /api/notebooks/<id> - Delete a notebook

Content Processing

  • POST /api/upload - Upload and extract text from files
  • POST /api/extract_url - Extract content from a URL
  • POST /api/extract_youtube - Extract YouTube video transcript

AI Tools

  • POST /api/chat - Chat with AI assistant
  • POST /api/tool_action - Generate content with AI tools (mindmap, reports, flashcards, quiz, slides)

Technologies Used

  • Backend: Flask (Python web framework)
  • Database: MongoDB (document storage)
  • AI: Google Gemini API (generative AI)
  • Document Processing: PyMuPDF, python-docx, mammoth
  • Web Scraping: BeautifulSoup4, requests
  • YouTube: youtube-transcript-api
  • Frontend: HTML, CSS, JavaScript

License

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

Author

Pushkar Singh

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.

Acknowledgments

  • Google Gemini API for AI capabilities
  • MongoDB for database solutions
  • The open-source community for the excellent libraries used in this project

About

An AI notebook that eats PDFs, DOCX, URLs and YouTube transcripts, then turns them into mind maps, reports, flashcards, quizzes and slide decks.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages