πŸ“„ Local PDF AI β€” try it in your browser

Ask questions about your PDFs in plain English β€” 100% in your browser. No upload, no account, no API key. Your PDF never leaves your machine: PDF.js (from a CDN) extracts the text locally, and the same TF-IDF search as the Python tool runs in JavaScript.

The demo works immediately: a built-in sample β€” The Beginner's Guide to Growing Tomatoes, the repo's offline test fixture β€” is already indexed below. Ask it a question, or upload your own PDF instead.

1. Choose a document

Drop a PDF here, or

Scanned image-only PDFs have no extractable text and are rejected β€” no OCR yet, same as the Python tool.

2. Ask a question

Try one:

Answer

Loading the sample…

How it works

~600-char chunks 100-char overlap TF-IDF + cosine 0 network calls for search

The JavaScript in app.js is a direct port of the Python backend: localpdfai/chunking.py (chunks never cross a page boundary, so every citation points at exactly one page), localpdfai/embeddings.py (same stopword list, idf = ln((n+1)/(df+1)) + 1, log-scaled term frequency, L2-normalised rows) and localpdfai/index.py (cosine search, ties broken by chunk order β€” the same question always returns the same passages). Answers are extractive: quoted passages with [p. N] citations and relevance scores. Nothing is invented β€” and nothing is summarised either; generative answers need the optional local Ollama model in the Python tool.

On the built-in sample the browser search reproduces the Python results exactly: 4 pages, 7 chunks, 6/6 questions top-1 correct (see the full fixture transcript). For an uploaded PDF the numbers can differ slightly from the CLI, because PDF.js and pypdf extract text a little differently β€” the ranking method is identical.

Honest limitations

Local PDF AI on GitHub β€” MIT licensed. Prefer the command line? pip install -r requirements.txt, then python -m localpdfai ask --pdf your.pdf --q "your question". Measured results on a real document: sample Q&A page.