# dinesh31r/old-kannada-glyph-recognition architecture

> Architecture diagram of the GitHub repository dinesh31r/old-kannada-glyph-recognition, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dinesh31r/old-kannada-glyph-recognition
- Repository: https://github.com/dinesh31r/old-kannada-glyph-recognition

## Overview

ShilaaLipi is a local-first OCR and translation application for old Kannada inscriptions. A user uploads an inscription through the React workspace; the API coordinates preprocessing, glyph segmentation and recognition, then returns old Kannada text with modern Kannada and English translations. The UI also supports manual box editing, glyph review, class exploration and performance reports. The README documents the recognition stages and optional retrieval-augmented correction; sampled pipeline code queries RAG but does not apply its results to the returned text, so that link is shown as retrieval only.

Main entry points: [`frontend/src/App.jsx`](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/App.jsx) (Workspace App), [`backend/src/pipeline.py`](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/pipeline.py) (Epigraphy Pipeline), [`backend/api_server.py`](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/api_server.py) (FastAPI Routes), [`backend/src/runtime_service.py`](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/runtime_service.py) (Runtime Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User Workspace"]
  node_app["Workspace App<br/>[App.jsx]"]
  node_canvas["Canvas Editor"]
  node_glyph_review["Glyph Review"]
  node_text_renderer["Text Renderer"]
  node_report_dashboard["Report Dashboard"]
  node_bootstrap_hook["Workspace Bootstrap<br/>[useBootstrap.js]"]
  node_frontend_api["API Client<br/>[api.js]"]
end

subgraph group_api["API Services"]
  node_http_api["FastAPI Routes<br/>[api_server.py]"]
  node_inference_service["Inference Service"]
  node_runtime["Runtime Services<br/>[runtime_service.py]"]
end

subgraph group_recognition["Recognition Pipeline"]
  node_pipeline["Epigraphy Pipeline<br/>[pipeline.py]"]
  node_preprocessing["Image Preprocessing<br/>[preprocessing.py]"]
  node_segmentation["Glyph Segmentation<br/>[segment.py]"]
  node_recognizer["Consensus Recognition<br/>[infer.py]"]
  node_inference_math["Shape Matching<br/>[inference.py]"]
end

subgraph group_knowledge["Translation and Insights"]
  node_translator["Translation<br/>[translation.py]"]
  node_rag["Inscription Retrieval<br/>[rag_engine.py]"]
  node_corpus["Inscription Corpus<br/>[rag_corpus.jsonl]"]
  node_reports["Metrics Reporting<br/>[report_service.py]"]
  node_class_data["Class Index<br/>[kannada.csv]"]
end

node_user(("Inscription User"))

node_user -->|"uses"| node_app
node_app -->|"edits regions"| node_canvas
node_app -->|"reviews glyphs"| node_glyph_review
node_app -->|"edits text"| node_text_renderer
node_app -->|"views reports"| node_report_dashboard
node_app -->|"loads workspace"| node_bootstrap_hook
node_app -->|"requests data"| node_frontend_api
node_frontend_api -->|"REST requests"| node_http_api
node_http_api -->|"dispatches inference"| node_inference_service
node_http_api -->|"loads runtime"| node_runtime
node_inference_service -->|"runs pipeline"| node_pipeline
node_pipeline -->|"preprocesses image"| node_preprocessing
node_pipeline -->|"detects glyphs"| node_segmentation
node_pipeline -->|"classifies glyphs"| node_recognizer
node_recognizer -->|"reranks candidates"| node_inference_math
node_pipeline -->|"queries matches"| node_rag
node_rag -->|"indexes corpus"| node_corpus
node_pipeline -->|"translates text"| node_translator
node_http_api -->|"serves metrics"| node_reports
node_http_api -->|"serves class data"| node_runtime
node_runtime -->|"loads index"| node_class_data
node_reports -->|"provides metrics"| node_report_dashboard

click node_app "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/App.jsx"
click node_canvas "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/InteractiveCanvasEditor.jsx"
click node_glyph_review "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/SingleGlyphReview.jsx"
click node_text_renderer "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/TextEditorRenderer.jsx"
click node_report_dashboard "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/SystemReportDashboard.jsx"
click node_bootstrap_hook "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/hooks/useBootstrap.js"
click node_frontend_api "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/api.js"
click node_http_api "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/api_server.py"
click node_inference_service "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/inference_service.py"
click node_runtime "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/runtime_service.py"
click node_pipeline "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/pipeline.py"
click node_preprocessing "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/preprocessing.py"
click node_segmentation "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/segment.py"
click node_recognizer "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/infer.py"
click node_inference_math "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/inference.py"
click node_translator "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/translation.py"
click node_rag "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/rag_engine.py"
click node_corpus "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/data/rag_corpus.jsonl"
click node_reports "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/report_service.py"
click node_class_data "https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/data/kannada.csv"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_canvas,node_glyph_review,node_text_renderer,node_report_dashboard,node_bootstrap_hook,node_frontend_api,node_user toneBlue
class node_http_api,node_inference_service,node_runtime toneAmber
class node_pipeline,node_preprocessing,node_segmentation,node_recognizer,node_inference_math toneMint
class node_translator,node_rag,node_corpus,node_reports,node_class_data toneRose
```

## Components

### User Workspace

- [Workspace App](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Canvas Editor](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/InteractiveCanvasEditor.jsx): `frontend/src/components/InteractiveCanvasEditor.jsx`
- [Glyph Review](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/SingleGlyphReview.jsx): `frontend/src/components/SingleGlyphReview.jsx`
- [Text Renderer](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/TextEditorRenderer.jsx): `frontend/src/components/TextEditorRenderer.jsx`
- [Report Dashboard](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/components/SystemReportDashboard.jsx): `frontend/src/components/SystemReportDashboard.jsx`
- [Workspace Bootstrap](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/hooks/useBootstrap.js): `frontend/src/hooks/useBootstrap.js`
- [API Client](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/frontend/src/api.js): `frontend/src/api.js`

### API Services

- [FastAPI Routes](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/api_server.py): `backend/api_server.py`
- [Inference Service](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/inference_service.py): `backend/src/inference_service.py`
- [Runtime Services](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/runtime_service.py): `backend/src/runtime_service.py`

### Recognition Pipeline

- [Epigraphy Pipeline](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/pipeline.py): `backend/src/pipeline.py`
- [Image Preprocessing](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/preprocessing.py): `backend/src/preprocessing.py`
- [Glyph Segmentation](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/segment.py): `backend/src/segment.py`
- [Consensus Recognition](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/infer.py): `backend/src/infer.py`
- [Shape Matching](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/inference.py): `backend/src/inference.py`

### Translation and Insights

- [Translation](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/translation.py): `backend/src/translation.py`
- [Inscription Retrieval](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/rag_engine.py): `backend/src/rag_engine.py`
- [Inscription Corpus](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/data/rag_corpus.jsonl): `data/rag_corpus.jsonl`
- [Metrics Reporting](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/backend/src/report_service.py): `backend/src/report_service.py`
- [Class Index](https://github.com/dinesh31r/old-kannada-glyph-recognition/blob/main/data/kannada.csv): `data/kannada.csv`

### Other components

- **Inscription User**

## Connections

- Inscription User → Workspace App: uses
- Workspace App → Canvas Editor: edits regions
- Workspace App → Glyph Review: reviews glyphs
- Workspace App → Text Renderer: edits text
- Workspace App → Report Dashboard: views reports
- Workspace App → Workspace Bootstrap: loads workspace
- Workspace App → API Client: requests data
- API Client → FastAPI Routes: REST requests
- FastAPI Routes → Inference Service: dispatches inference
- FastAPI Routes → Runtime Services: loads runtime
- Inference Service → Epigraphy Pipeline: runs pipeline
- Epigraphy Pipeline → Image Preprocessing: preprocesses image
- Epigraphy Pipeline → Glyph Segmentation: detects glyphs
- Epigraphy Pipeline → Consensus Recognition: classifies glyphs
- Consensus Recognition → Shape Matching: reranks candidates
- Epigraphy Pipeline → Inscription Retrieval: queries matches
- Inscription Retrieval → Inscription Corpus: indexes corpus
- Epigraphy Pipeline → Translation: translates text
- FastAPI Routes → Metrics Reporting: serves metrics
- FastAPI Routes → Runtime Services: serves class data
- Runtime Services → Class Index: loads index
- Metrics Reporting → Report Dashboard: provides metrics
