Skip to main content

An offline-capable, multi-provider AI study assistant for PDF books with VARK learning modes

Project description

๐Ÿ“š PDF Tutor

Study any PDF the way you learn best โ€” locally, privately, with diagrams, audio, flashcards, and hands-on commands.

Python License: MIT CI Platform PRs Welcome

PDF Tutor demo

PDF Tutor reads the table of contents of any PDF, lets you pick a chapter, and explains it through your preferred AI model โ€” fully offline on your own machine, or via free cloud APIs for higher quality. It adapts to how you learn using the VARK model: Visual diagrams, Auditory TTS, Read/Write notes, or Kinesthetic hands-on commands.


โšก Try it in 30 seconds

git clone https://github.com/Ashut90/pdf-tutor.git
cd pdf-tutor
pip install -r requirements.txt
python -m pdf_tutor

Drop any PDF onto the app, pick a chapter, pick a learning mode โ€” that's it.


โœจ Features

๐Ÿ“– Smart PDF handling

  • Auto-detects chapters from the PDF's table of contents
  • Dual viewer โ€” read extracted text or view actual rendered pages
  • Page-range control โ€” load a full chapter or a single section

๐Ÿค– Four AI providers (use whichever fits)

Provider Cost Runs Best for
Ollama Free Locally (offline) Privacy, no limits, no internet
Google Gemini Free tier Cloud Whole chapters (1M token context)
Groq Free tier Cloud Fast inference
OpenRouter Free tier Cloud Model variety

๐Ÿง  VARK learning system

Built around the VARK model (Visual, Auditory, Read/Write, Kinesthetic):

  • ๐ŸŽฏ Style detector โ€” a short quiz that recommends your learning style
  • ๐ŸŽจ Visual mode โ€” mind maps, flowcharts, comparison tables
  • ๐ŸŽง Auditory mode โ€” conversational explanations + text-to-speech playback
  • ๐Ÿ“ Read/Write mode โ€” definitions, structured notes, writing prompts
  • ๐Ÿ› ๏ธ Kinesthetic mode โ€” hands-on terminal commands and code experiments
  • ๐ŸŒ Omni mode โ€” all four styles in a single response

๐ŸŽจ Rich visual output

  • Mermaid diagrams rendered via online APIs with a local graphviz fallback (works offline)
  • Charts generated locally with matplotlib
  • ASCII diagrams for reliable inline visuals

๐Ÿ’พ Export & study tools

  • Save notes as Markdown, HTML, or plain text
  • Anki flashcard export โ€” auto-generates spaced-repetition cards
  • Mindmap export โ€” interactive HTML mindmaps
  • Text-to-speech โ€” listen to any explanation

๐Ÿ–ผ๏ธ Screenshots

Main window VARK learning modes
coming soon coming soon

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.9+
  • (Optional) Ollama for offline local models
  • (Optional) graphviz and espeak-ng system packages for diagram fallback and TTS

Installation

PDF Tutor runs on Linux, Windows, and macOS โ€” anywhere Python 3.9+ works.

1. Clone and enter the project:

git clone https://github.com/Ashut90/pdf-tutor.git
cd pdf-tutor

2. Create a virtual environment and install Python dependencies:

Linux / macOS
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Windows (PowerShell)
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

3. (Optional) install system packages for full features:

Feature Linux (Debian/Ubuntu) macOS (Homebrew) Windows
Diagram fallback sudo apt install graphviz brew install graphviz graphviz.org/download
Offline TTS sudo apt install espeak-ng built-in (uses say) built-in (SAPI5)

These are optional. Without graphviz, diagrams still render via online services. Without espeak-ng, TTS falls back to the online voice (gTTS).

Run

Same command on every OS:

python -m pdf_tutor
# or
python run.py

๐Ÿ”ง Setting up AI providers

Option 1 โ€” Ollama (free, local, offline)

# Install Ollama from https://ollama.com, then pull a model:
ollama pull qwen2.5-coder:7b     # great for technical content
ollama serve                     # starts the local server

In the app: select Ollama, no API key needed.

Option 2 โ€” Google Gemini (free, best for whole chapters)

  1. Get a free key at aistudio.google.com/apikey
  2. In the app: select Google Gemini, paste your key
  3. Gemini's 1M-token context handles entire chapters without truncation

Option 3 โ€” Groq / OpenRouter

Get free keys from console.groq.com or openrouter.ai and paste into the app.


๐Ÿ“‚ Project Structure

pdf-tutor/
โ”œโ”€โ”€ pdf_tutor/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __main__.py          # entry point: python -m pdf_tutor
โ”‚   โ”œโ”€โ”€ config.py            # theme, fonts, providers, limits
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ””โ”€โ”€ pdf.py           # TOC extraction, text/page rendering
โ”‚   โ”œโ”€โ”€ ai/
โ”‚   โ”‚   โ””โ”€โ”€ client.py        # unified client for all 4 providers
โ”‚   โ”œโ”€โ”€ rendering/
โ”‚   โ”‚   โ””โ”€โ”€ visuals.py       # mermaid / chart / graphviz rendering
โ”‚   โ”œโ”€โ”€ learning/
โ”‚   โ”‚   โ””โ”€โ”€ modes.py         # teaching modes + VARK prompts
โ”‚   โ””โ”€โ”€ ui/
โ”‚       โ””โ”€โ”€ app.py           # Tkinter GUI (3-pane layout)
โ”œโ”€โ”€ tests/                   # pytest suite
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

๐Ÿ—๏ธ Architecture

Architecture flow

The UI loads a chapter via core/pdf.py, sends its text plus a mode-specific prompt (learning/modes.py) to the selected provider (ai/client.py), and renders any diagrams the AI produces (rendering/visuals.py).


๐Ÿงช Running tests

pip install -r requirements-dev.txt
pytest -v

๐Ÿ—บ๏ธ Roadmap

  • Conversation history persistence across sessions
  • Multi-PDF library with search
  • Spaced-repetition scheduler built in (beyond Anki export)
  • Support for EPUB and DjVu formats
  • Configurable prompt templates per subject

๐Ÿค Contributing

Contributions are welcome. Please open an issue to discuss major changes first.

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Run the tests (pytest)
  4. Commit and open a pull request

๐Ÿ“ License

MIT โ€” see LICENSE.


๐Ÿ™ Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kritrim_smriti-1.0.0.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kritrim_smriti-1.0.0-py3-none-any.whl (43.6 kB view details)

Uploaded Python 3

File details

Details for the file kritrim_smriti-1.0.0.tar.gz.

File metadata

  • Download URL: kritrim_smriti-1.0.0.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kritrim_smriti-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5bad98e307febc3a1d14175ee87ae6fcdc8e811c1e116c5c55fe93cda8a2b05e
MD5 6b8f12b8d264043134378433fd16d3c9
BLAKE2b-256 eb76ff406edc6993a92e2381b74e41b75b008a9b61bafe7a9de6a4c765ede1c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for kritrim_smriti-1.0.0.tar.gz:

Publisher: release.yml on Ashut90/pdf-tutor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kritrim_smriti-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: kritrim_smriti-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 43.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kritrim_smriti-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 788645006969fca24444e70b5da76c7c763c21da6654f6eb17dbf8006d2051eb
MD5 4096191664ec357e856e94d79a38dc36
BLAKE2b-256 09f03d131dd5a12c68a993c698edc52323166b559457a3a0611e29659c635ae7

See more details on using hashes here.

Provenance

The following attestation bundles were made for kritrim_smriti-1.0.0-py3-none-any.whl:

Publisher: release.yml on Ashut90/pdf-tutor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page