How devesh176/translation_studio works
Translation Studio is a PDF translation platform: users upload a document, start translation, and retrieve a translated PDF and its structure. The worker parses the PDF into a structure-preserving IR, handles OCR and semantic translation units, routes translation to providers, validates results, and renders the output. The API also exposes cost and section-editing capabilities; the web app provides the interactive studio. Workflow links are supported by the README and indexed references; unsampled implementation details are not expanded into extra steps.
Main entry points: pipeline.py Translation worker · documents.py Document API · app.js Web studio · pymupdf_parser.py PDF to IR parser
Components 24
API and Studio
- Web studio
apps/web/app.js - Document API
apps/api/routes/documents.py - Section editing API
apps/api/routes/sections.py
Document Pipeline
- Translation worker
apps/worker/tasks/pipeline.py - Prompt editing
apps/worker/tasks/section_edit.py - PDF classifier
packages/document/parser/pdf_classifier.py - PDF to IR parser
packages/document/parser/pymupdf_parser.py - Document IR
packages/core/domain/node.py - Bodhan OCR
packages/providers/bodhan/ocr.py
Translation and QA
- Semantic units
packages/semantic/units.py - Segment grouping
packages/semantic/segments.py - Translation router
packages/routing/translation_router.py - Bodhan translation
packages/providers/bodhan/translation.py - OpenRouter translation
packages/providers/openrouter/translation.py - Invariant validation
packages/validation/invariants.py - Semantic QA
packages/semantic/qa.py
PDF Rendering
- PDF renderer
packages/rendering/pdf_renderer.py - Layout engine
packages/rendering/layout_engine.py - Visual QA
packages/validation/visual.py
State and Operations
- Object storage
packages/storage/object_store/base.py - Cost ledger
packages/costs/ledger.py - Configuration loader
packages/core/config_loader.py - Observability
packages/observability/metrics.py
Other components
- Document user
Connections 26
- Document user → Web studio: uses
README.md - Document user → Document API: uploads PDF
README.md - Web studio → Document API: calls API
- Document API → PDF classifier: classifies upload
apps/api/routes/documents.py - Document API → Object storage: stores and reads
apps/api/routes/documents.py - Document API → Translation worker: starts translation
apps/api/routes/documents.py - Document API → Cost ledger: reads costs
apps/api/routes/documents.py - Section editing API → Prompt editing: starts edit
- Translation worker → PDF classifier: classifies PDF
apps/worker/tasks/pipeline.py - Translation worker → PDF to IR parser: parses PDF
apps/worker/tasks/pipeline.py - PDF to IR parser → Document IR: creates nodes
packages/document/parser/pymupdf_parser.py - Translation worker → Bodhan OCR: requests OCR
apps/worker/tasks/pipeline.py - Translation worker → Semantic units: groups paragraphs
README.md - Translation worker → Segment grouping: uses segments
apps/worker/tasks/pipeline.py - Translation worker → Translation router: selects provider
apps/worker/tasks/pipeline.py - Translation router → Configuration loader: loads routing rules
packages/routing/translation_router.py - Translation worker → Bodhan translation: dispatches translation
apps/worker/tasks/pipeline.py - Translation worker → OpenRouter translation: dispatches translation
apps/worker/tasks/pipeline.py - Translation worker → Invariant validation: validates invariants
README.md - Translation worker → Semantic QA: checks translation
README.md - Translation worker → PDF renderer: renders PDF
README.md - PDF renderer → Layout engine: fits text
packages/rendering/pdf_renderer.py - Translation worker → Visual QA: checks rendered PDF
README.md - Translation worker → Cost ledger: records cost
README.md - Translation worker → Object storage: persists results
- Document API → Observability: reports metrics