r/Python • • 21d ago

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

28 Upvotes

156 comments sorted by

View all comments

2

u/gushmazuko 16d ago

Basira Vision: scanned book in, typeset translation out (vision OCR + translation + Typst)

What My Project Does

Basira Vision is an open-source Python CLI with a three-step pipeline:

  1. `basira ocr book.pdf`: renders each page to an image and uses a vision model to extract text. Designed for scans with no text layer, skewed or noisy pages, and non-Latin scripts where classic OCR engines struggle.
  2. `basira translate book.md --target-language russian`: translates page by page using a one-page sliding window. The previous page's finished translation is passed along as context for continuity. A failed page clears the window instead of polluting the next one.
  3. `basira typst book_russian.md`: typesets the result as an A5 book using Pandoc + Typst (title page, TOC, running headers, footnotes) from an editable template (`basira export template` provides a local copy to modify).

Between steps, you get standard markdown files with `<!-- Page N -->` markers for human review and manual corrections. Progress is saved per page; `--resume` processes only missing or failed pages.

Prompts are included for Arabic, Chechen, English, French, German, and Russian. It uses the Gemini API protocol. By setting `GEMINI_BASE_URL`, you can point it to any Gemini-compatible local gateway or local vision model.

Тarget Audience

Developers, translators, small publishers, language communities, and hobbyists digitizing or republishing scanned and public-domain literature. This is a fully tested CLI package (CI, PyPI, MIT licensed).

Comparison

- Tesseract and classic OCR engines require clean scans and pre-trained language data; vision models handle noise and complex typography much better and output structured markdown.
- PDF-to-markdown tools (Marker, olmOCR, etc.) stop at extraction; Basira Vision covers the full pipeline through contextual translation and Typst typesetting.
-Pasting PDFs into web chat interfaces breaks down over long documents due to context drift, loss of page structure, and lack of resumability.

- PyPI / uv: `uv tool install basira-vision`
- GitHub: https://github.com/gushmazuko/basira-vision