Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Academic Paper Analyst (Local PDF Summarizer Chatbot)

Project page: https://robertjam954.github.io/local_pdf_summarizer_chatbot/ (GitHub Pages, auto-deployed from site/). The app itself runs locally against LM Studio - there is no hosted deployment.

A local web chatbot that gives you a comprehensive, structured analysis of an academic paper from an uploaded PDF, using a local vision-language model in LM Studio. Each page is rendered to an image and read by the model, so figures, tables, and layout are analyzed - not just extracted text. Your paper never leaves the machine.

Built with Chainlit (chat UI + streaming + file upload + MCP), the OpenAI Python SDK (pointed at LM Studio), and PyMuPDF (page rendering). The UI is styled to match the multimodal RAG AI tutor.

Model provider. By default the app runs fully locally against LM Studio. If ANTHROPIC_API_KEY is set (for example a shared/cloud deploy with no LM Studio available), it instead talks to Claude through Anthropic's OpenAI-compatible endpoint - same client, same vision message format. See Model provider below.

What it does

Upload a PDF in the chat window and get back a structured report: Paper Overview, Abstract Summary, Key Contributions, Methodology, Key Findings, Figures & Tables Analysis, Technical Concepts Explained, Strengths, Limitations, Practical Implications, and a TL;DR. The analyzed pages are attached as a clickable Source side panel. Then ask follow-up questions about the same paper. Optionally connect MCP servers to load PDFs from disk or fetch web context.

Project docs (read these first)

Doc What it covers
PRODUCT.md Vision, scope, success criteria
ARCHITECTURE.md System design, data flow, key decisions
CONTRIBUTING.md Setup, local dev loop, conventions, PR checklist
docs/mcp-setup.md Connecting filesystem / fetch MCP servers
docs/paper-summarizer-prompt.md Project artifact: the Paper Summarizer system prompt
docs/plans/ Per-feature implementation plans

Prerequisites

  1. Install LM Studio.
  2. Download and load a vision-language model that supports images (default: Qwen3-VL 4B, qwen/qwen3-vl-4b). Text-only models (e.g. google/gemma-3-1b) also work - the app sends extracted page text instead of page images, at the cost of not seeing figures/tables.
  3. Start LM Studio's local server (default http://127.0.0.1:1234).

Quick start (local)

cd src
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env            # set LM_STUDIO_MODEL to your loaded model id
chainlit run app.py -w          # http://localhost:8000

Upload a paper and watch the structured analysis stream back - fully offline.

Model provider

The app selects its model at startup from environment variables:

  • No ANTHROPIC_API_KEY set (default): LM Studio (local). The model is whatever is loaded in LM Studio, addressed by LM_STUDIO_MODEL at LM_STUDIO_BASE_URL. Nothing leaves the machine.
  • ANTHROPIC_API_KEY set: Claude (Anthropic). The app calls Claude via Anthropic's OpenAI-compatible endpoint (ANTHROPIC_BASE_URL, default https://api.anthropic.com/v1/), using ANTHROPIC_MODEL (default claude-opus-4-8, which must be vision-capable). This path is used by the container/Render deploy, where no LM Studio process exists. In this mode the paper is sent to the Anthropic API rather than staying on-device.

Both providers share the same AsyncOpenAI client and the same base64 page-image message format.

Run in a container

The model stays in LM Studio on the host; the container reaches it via host.docker.internal:

docker build -t paper-analyst .
docker run -p 8000:8000 \
  -e LM_STUDIO_BASE_URL=http://host.docker.internal:1234/v1 \
  -e LM_STUDIO_MODEL=qwen2.5-vl-7b-instruct \
  paper-analyst
# Linux: add --add-host=host.docker.internal:host-gateway

Deployment

  • GitHub Pages (the deployment for this project): the portfolio landing page in site/ is published automatically by .github/workflows/pages.yml on every push to https://robertjam954.github.io/local_pdf_summarizer_chatbot/.
  • The app runs locally (see Quick start) - by design, papers never leave the machine.
  • Unused option: render.yaml is a Render Blueprint for a hosted deploy against Claude (ANTHROPIC_API_KEY switches the provider). Kept for completeness; not deployed.

Configuration

Env var Default Purpose
LM_STUDIO_BASE_URL http://127.0.0.1:1234/v1 LM Studio OpenAI-compatible endpoint
LM_STUDIO_API_KEY lm-studio Ignored by LM Studio; any value works
LM_STUDIO_MODEL qwen/qwen3-vl-4b The loaded model id
PDF_INPUT_MODE auto images (vision models) or text (text-only models)
ANTHROPIC_API_KEY - If set, use Claude instead of LM Studio (cloud path)
ANTHROPIC_BASE_URL https://api.anthropic.com/v1/ Anthropic OpenAI-compatible endpoint
ANTHROPIC_MODEL claude-opus-4-8 Vision-capable Claude model (when key is set)
RENDER_DPI 150 PDF page render resolution
MAX_PDF_PAGES 30 Reject longer PDFs (image-token budget)
MAX_PDF_MB 50 Reject larger PDFs
MAX_IMAGE_LONG_EDGE 1600 Downscale page images past this many px
TEMPERATURE 0.3 Sampling temperature
KEEP_IMAGES_IN_HISTORY 0 1 keeps page images across follow-ups (more tokens)
APP_PASSWORD - If set, gates the app behind a password (shared deploys)
CHAINLIT_AUTH_SECRET - Required by Chainlit auth when APP_PASSWORD is set

Limits

PDF uploads must be application/pdf, and by default <= 50 MB and <= 30 pages (a local image/token budget, not an API limit). Raise MAX_PDF_PAGES / lower RENDER_DPI for longer papers. The app validates before rendering and returns a friendly error.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages