Repository navigation
v1: runnable extraction, sources, Q&A, batch and web demo - #1
Merged
Merged
Conversation
added 13 commits
November 11, 2026 23:49
Seven fictional PDFs (four invoice layouts, two contracts, one image-only scan) generated with reportlab, each with a ground-truth JSON file.
- PDF words with page and box coordinates (pdfplumber, pypdfium2) - OCR for scanned pages: Florence-2 (hf) or a vision model (api) - YAML schemas mapped to typed JSON, each value linked to its source - Q&A with cited passages: bge-m3 embeddings or BM25 - Backends selected with MS_BACKEND: OpenAI-compatible API or transformers - CLI: extract, ask, batch, serve; Gradio demo in app.py
Split passages at clause headings, ask for a one-sentence answer that ends with a citation, re-point citations that clearly name the wrong passage, drop citations from 'not found' answers, and mean-pool per-token vectors from embedding endpoints that return them.
Scrollable left panel next to a fixed page view, sample picker with an upload button, field badges placed beside their boxes, and Modelshifts colours.
Verified Quickstart, API backend notes, schemas, samples and tests, limitations, ticked Roadmap items and the demo GIF/MP4.
Qwen2.5-1.5B answered 'not found' to a question its top passage answered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes document-extractor runnable end to end (v1). Do not merge until reviewed.
What's in it
scripts/make_samples.pygeneratessamples/: 4 invoice layouts, 2 contracts, 1 image-only scan, each with a ground-truth JSON. All names and numbers are fictional.src/document_extractor/: PDF words with page and box (pdfplumber, pypdfium2); OCR for scans (Florence-2 onhf, optional vision model onapi); YAML schemas to typed JSON with a{page, bbox, text}source per value; Q&A with cited passages (bge-m3, or BM25).MS_BACKEND:api(OpenAI-compatible:MS_API_BASE,MS_API_KEY,MS_MODEL) andhf(transformers, default Qwen2.5-7B-Instruct,MS_HF_MODELfor 1.5B on CPU).extract,ask,batch,serve. Gradio demo inapp.py.Verified on a CPU-only machine, from a fresh clone in a fresh venv
hfbackend with Qwen2.5-1.5B-Instruct:extract,ask,batch,serveandscripts/evaluate.pyon all samples.apibackend against a local llama-cpp-python server running Qwen2.5-1.5B-Instruct (Q4_K_M GGUF), using the README commands.apibackend (only mocked).The demo recording replays results that the 1.5B model computed earlier on this machine; the same question gives the same answer when run live.