| title | SummaPDF |
|---|---|
| emoji | 📄 |
| colorFrom | purple |
| colorTo | blue |
| sdk | docker |
| app_port | 7860 |
| pinned | false |
A web app that summarizes PDF documents using Hugging Face's BART-large-CNN model.
- FastAPI — async Python web framework
- HTMX — interactivity without writing JavaScript
- Tailwind CSS — utility-first styling (via CDN)
- Jinja2 — server-rendered templates
- pypdf — PDF text extraction
- transformers + PyTorch — running
facebook/bart-large-cnnlocally
- Drag-and-drop PDF upload with file preview (name + size)
- Length presets (Brief / Balanced / Detailed) plus a manual min/max under "Advanced"
- Chunked summarization for long documents
- Result card with stats: source characters, summary words, compression %
- Copy-to-clipboard and
.txtdownload - Inline error reporting and a button-embedded loading state, all via HTMX
- Dark UI with gradient mesh background, Inter typography, subtle animations
git clone https://github.com/shexiee/summapdf.git
cd summapdf
pip install -r requirements.txtThe first run downloads the BART model (~1.6 GB) into the Hugging Face cache.
uvicorn main:app --reloadOpen http://localhost:8000.
.
├── main.py # FastAPI app + summarization logic
├── templates/
│ ├── base.html # HTML shell (Tailwind + HTMX)
│ ├── index.html # Upload form
│ └── partials/
│ ├── summary.html # HTMX swap target on success
│ └── error.html # HTMX swap target on failure
├── static/ # Optional static assets
└── requirements.txt
- The form
POSTs a PDF to/summarizevia HTMX (multipart/form-data). pypdfextracts the document text.- The text is sliced into 1024-character chunks (BART's input limit).
- Each chunk is summarized; the summaries are concatenated.
- The server returns an HTML partial, which HTMX swaps into the page — no full reload.
Any host that runs Python works (Render, Railway, Fly.io, a VPS). Example start command:
uvicorn main:app --host 0.0.0.0 --port $PORTNote: the Tailwind CDN logs a console warning in production. For a polished deploy, swap it for a compiled stylesheet (npx tailwindcss -i input.css -o static/app.css --minify) and serve from /static.
- Python 3.9+
- ~2 GB free disk for the model cache
- CPU works; a GPU dramatically speeds up summarization