# badrinath2605/multilingual-ocr-web-application architecture

> Architecture diagram of the GitHub repository badrinath2605/multilingual-ocr-web-application, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/badrinath2605/multilingual-ocr-web-application
- Repository: https://github.com/badrinath2605/multilingual-ocr-web-application

## Overview

This is a Gradio multilingual OCR application backed by EasyOCR for Urdu and IndicPhotoOCR for Hindi and Kannada. The principal flow is image input and language selection, preprocessing and language routing, OCR inference, then displaying extracted text. IndicPhotoOCR identifies script, detects text regions, and recognizes text. The README also documents sample-image support. Internal wiring beyond the sampled OCR entry point is limited to relationships shown in excerpts or explicitly documented; unsampled implementation details are not assumed.

Main entry points: [`IndicPhotoOCR/IndicPhotoOCR/ocr.py`](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/ocr.py) (OCR orchestrator), [`app.py`](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py) (Gradio interface), [`IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/textbpnpp_detector.py`](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/textbpnpp_detector.py) (TextBPN detector), [`IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/module.py`](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/module.py) (Recognition data module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_gradio["Gradio interface<br/>[app.py]"]
  node_sample["Sample images<br/>[app.py]"]
  node_result["Extracted text<br/>[app.py]"]
end

subgraph group_routing["Language routing"]
  node_language["Language router<br/>[app.py]"]
  node_urduprep["Urdu preprocessing<br/>[app.py]"]
  node_easyocr["EasyOCR Urdu<br/>[app.py]"]
end

subgraph group_indic["IndicPhotoOCR runtime"]
  node_indicentry["OCR orchestrator<br/>[ocr.py]"]
  node_scriptid["Script identification<br/>[vit_infer.py]"]
  node_detector["TextBPN detector"]
  node_textnet["TextNet model<br/>[textnet.py]"]
  node_detectconfig["Detector configuration<br/>[config.py]"]
end

subgraph group_recognition["Recognition components"]
  node_recogniser["PARSeq recogniser"]
  node_parseq["PARSeq model<br/>[model.py]"]
  node_basesystem["Recognition base<br/>[base.py]"]
  node_datasets["Recognition datasets<br/>[dataset.py]"]
  node_augment["Image augmentation<br/>[augment.py]"]
  node_datamodule["Recognition data module<br/>[module.py]"]
end

node_user(("User"))

node_user -->|"uploads image"| node_gradio
node_gradio -->|"submits input"| node_language
node_sample -->|"offers examples"| node_gradio
node_language -->|"routes Urdu"| node_urduprep
node_urduprep -->|"preprocesses image"| node_easyocr
node_language -->|"routes Indic"| node_indicentry
node_easyocr -->|"returns text"| node_result
node_indicentry -->|"initializes detector"| node_detector
node_indicentry -->|"initializes recogniser"| node_recogniser
node_indicentry -->|"initializes identifier"| node_scriptid
node_detector -->|"constructs model"| node_textnet
node_detector -->|"loads configuration"| node_detectconfig
node_recogniser -.->|"uses model"| node_parseq
node_parseq -.->|"extends runtime"| node_basesystem
node_datamodule -->|"builds datasets"| node_datasets
node_datamodule -->|"loads augmentation"| node_augment
node_indicentry -->|"returns text"| node_result
node_gradio -->|"displays text"| node_result

click node_gradio "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py"
click node_sample "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py"
click node_language "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py"
click node_urduprep "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py"
click node_easyocr "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py"
click node_indicentry "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/ocr.py"
click node_scriptid "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/script_identification/vit/vit_infer.py"
click node_detector "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/textbpnpp_detector.py"
click node_textnet "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/network/textnet.py"
click node_detectconfig "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/cfglib/config.py"
click node_recogniser "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/recognition/parseq_recogniser.py"
click node_parseq "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/models/parseq/model.py"
click node_basesystem "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/models/base.py"
click node_datasets "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/dataset.py"
click node_augment "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/augment.py"
click node_datamodule "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/module.py"
click node_result "https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py"

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_gradio,node_sample,node_result,node_user toneBlue
class node_language,node_urduprep,node_easyocr toneAmber
class node_indicentry,node_scriptid,node_detector,node_textnet,node_detectconfig toneMint
class node_recogniser,node_parseq,node_basesystem,node_datasets,node_augment,node_datamodule toneRose
```

## Components

### Web application

- [Gradio interface](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py): `app.py`
- [Sample images](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py): `app.py`
- [Extracted text](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py): `app.py`

### Language routing

- [Language router](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py): `app.py`
- [Urdu preprocessing](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py): `app.py`
- [EasyOCR Urdu](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/app.py): `app.py`

### IndicPhotoOCR runtime

- [OCR orchestrator](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/ocr.py): `IndicPhotoOCR/IndicPhotoOCR/ocr.py`
- [Script identification](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/script_identification/vit/vit_infer.py): `IndicPhotoOCR/IndicPhotoOCR/script_identification/vit/vit_infer.py`
- [TextBPN detector](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/textbpnpp_detector.py): `IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/textbpnpp_detector.py`
- [TextNet model](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/network/textnet.py): `IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/network/textnet.py`
- [Detector configuration](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/cfglib/config.py): `IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/cfglib/config.py`

### Recognition components

- [PARSeq recogniser](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/recognition/parseq_recogniser.py): `IndicPhotoOCR/IndicPhotoOCR/recognition/parseq_recogniser.py`
- [PARSeq model](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/models/parseq/model.py): `IndicPhotoOCR/IndicPhotoOCR/utils/strhub/models/parseq/model.py`
- [Recognition base](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/models/base.py): `IndicPhotoOCR/IndicPhotoOCR/utils/strhub/models/base.py`
- [Recognition datasets](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/dataset.py): `IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/dataset.py`
- [Image augmentation](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/augment.py): `IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/augment.py`
- [Recognition data module](https://github.com/badrinath2605/multilingual-ocr-web-application/blob/main/IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/module.py): `IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/module.py`

### Other components

- **User**

## Connections

- User → Gradio interface: uploads image (evidence: `README.md`)
- Gradio interface → Language router: submits input (evidence: `app.py`)
- Sample images → Gradio interface: offers examples (evidence: `README.md`)
- Language router → Urdu preprocessing: routes Urdu (evidence: `app.py`)
- Urdu preprocessing → EasyOCR Urdu: preprocesses image (evidence: `app.py`)
- Language router → OCR orchestrator: routes Indic (evidence: `app.py`)
- EasyOCR Urdu → Extracted text: returns text (evidence: `app.py`)
- OCR orchestrator → TextBPN detector: initializes detector (evidence: `IndicPhotoOCR/IndicPhotoOCR/ocr.py`)
- OCR orchestrator → PARSeq recogniser: initializes recogniser (evidence: `IndicPhotoOCR/IndicPhotoOCR/ocr.py`)
- OCR orchestrator → Script identification: initializes identifier (evidence: `IndicPhotoOCR/IndicPhotoOCR/ocr.py`)
- TextBPN detector → TextNet model: constructs model (evidence: `IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/textbpnpp_detector.py`)
- TextBPN detector → Detector configuration: loads configuration (evidence: `IndicPhotoOCR/IndicPhotoOCR/detection/textbpn/textbpnpp_detector.py`)
- PARSeq recogniser → PARSeq model: uses model
- PARSeq model → Recognition base: extends runtime
- Recognition data module → Recognition datasets: builds datasets (evidence: `IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/module.py`)
- Recognition data module → Image augmentation: loads augmentation (evidence: `IndicPhotoOCR/IndicPhotoOCR/utils/strhub/data/module.py`)
- OCR orchestrator → Extracted text: returns text (evidence: `README.md`)
- Gradio interface → Extracted text: displays text (evidence: `README.md`)
