# yashrajsahu44/saarthi architecture

> Architecture diagram of the GitHub repository yashrajsahu44/saarthi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashrajsahu44/saarthi
- Repository: https://github.com/yashrajsahu44/saarthi

## Overview

SAARTHI is an accessibility web application whose flagship SEE workflow helps a user inspect a view through object detection, OCR/document reading, scene description, and visual Q&A. The tree and excerpts show browser-local detector/OCR engines and backend scene/VQA services; the README documents EXPRESS AAC and SPEAK captions/sound alerts. UI-module wiring and those latter feature implementations were not sampled, so their internal links are omitted. Chotuu is documented, but no corresponding source path appears in the supplied tree.

Main entry points: [`frontend/src/App.tsx`](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/App.tsx) (Application shell), [`backend/app/services/vqa/service.py`](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/service.py) (Visual Q&A), [`frontend/src/modules/see/SeeView.tsx`](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/see/SeeView.tsx) (SEE workspace), [`backend/app/services/scene/service.py`](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/service.py) (Scene description)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Accessible client"]
  node_app["Application shell<br/>[App.tsx]"]
  node_see_view["SEE workspace<br/>[SeeView.tsx]"]
  node_express["EXPRESS AAC<br/>[ExpressView.tsx]"]
  node_speak["SPEAK captions<br/>[SpeakView.tsx]"]
  node_home["Home navigation<br/>[HomeView.tsx]"]
  node_settings["Accessibility settings<br/>[SettingsView.tsx]"]
  node_camera["Camera capture<br/>[CameraManager.ts]"]
  node_aac_speech["Speech synthesis"]
  node_audio["Microphone capture<br/>[AudioManager.ts]"]
end

subgraph group_vision["SEE vision"]
  node_detector["Object detection<br/>[DetectorEngine.ts]"]
  node_coco["COCO labels<br/>[cocoClasses.ts]"]
  node_detector_hook["Detector lifecycle<br/>[useDetector.ts]"]
  node_ocr["OCR recognition<br/>[OCREngine.ts]"]
end

subgraph group_server["SEE services"]
  node_scene_api["SEE API routes<br/>[see.py]"]
  node_scene_service["Scene description<br/>[service.py]"]
  node_scene_blip["BLIP captioning<br/>[blip_describer.py]"]
  node_scene_cloud["Cloud vision<br/>[cloud_vision.py]"]
  node_scene_heuristic["Heuristic captioning"]
  node_scene_translate["Scene translation<br/>[translator.py]"]
  node_scene_schema["Scene contract<br/>[scene.py]"]
  node_vqa_service["Visual Q&amp;A<br/>[service.py]"]
  node_vqa_blip["BLIP visual Q&amp;A<br/>[blip_vqa.py]"]
  node_vqa_cloud["Cloud visual Q&amp;A<br/>[cloud_vqa.py]"]
  node_vqa_guard["Q&amp;A guardrails<br/>[guardrails.py]"]
  node_vqa_heuristic["Heuristic Q&amp;A<br/>[heuristic_vqa.py]"]
  node_vqa_translate["Answer translation<br/>[translator.py]"]
  node_vqa_schema["Q&amp;A contract<br/>[vqa.py]"]
end

subgraph group_platform["Backend platform"]
  node_api_router["API router<br/>[router.py]"]
  node_app_server["FastAPI application<br/>[main.py]"]
  node_database[("Async database<br/>[database.py]")]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_user(("Accessibility user"))

node_user -.->|"opens"| node_app
node_app -.->|"offers module"| node_see_view
node_app -.->|"offers module"| node_express
node_app -.->|"offers module"| node_speak
node_app -.->|"offers navigation"| node_home
node_app -.->|"offers settings"| node_settings
node_see_view -.->|"captures view"| node_camera
node_detector -->|"uses labels"| node_coco
node_detector_hook -->|"runs inference"| node_detector
node_see_view -.->|"uses detection"| node_detector_hook
node_see_view -.->|"reads documents"| node_ocr
node_see_view -.->|"requests scene"| node_scene_api
node_scene_api -->|"requests description"| node_scene_service
node_scene_api -->|"requests answer"| node_vqa_service
node_scene_service -->|"tries cloud"| node_scene_cloud
node_scene_service -->|"selects provider"| node_scene_blip
node_scene_service -->|"falls back"| node_scene_heuristic
node_scene_service -.->|"returns payload"| node_scene_schema
node_vqa_service -->|"checks question"| node_vqa_guard
node_vqa_service -->|"tries cloud"| node_vqa_cloud
node_vqa_service -->|"selects provider"| node_vqa_blip
node_vqa_service -->|"falls back"| node_vqa_heuristic
node_vqa_service -.->|"returns payload"| node_vqa_schema
node_scene_blip -->|"translates output"| node_scene_translate
node_scene_cloud -->|"translates output"| node_scene_translate
node_vqa_blip -->|"translates answer"| node_vqa_translate
node_vqa_cloud -->|"translates answer"| node_vqa_translate
node_app_server -->|"mounts routes"| node_api_router
node_api_router -->|"registers routes"| node_scene_api
node_app_server -->|"initializes lifecycle"| node_database
node_database -->|"reads settings"| node_config
node_express -.->|"speaks phrases"| node_aac_speech
node_speak -.->|"captures speech"| node_audio

click node_app "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/App.tsx"
click node_see_view "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/see/SeeView.tsx"
click node_express "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/express/ExpressView.tsx"
click node_speak "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/speak/SpeakView.tsx"
click node_home "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/home/HomeView.tsx"
click node_settings "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/settings/SettingsView.tsx"
click node_camera "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/camera/CameraManager.ts"
click node_detector "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/detector/DetectorEngine.ts"
click node_coco "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/detector/cocoClasses.ts"
click node_detector_hook "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/detector/useDetector.ts"
click node_ocr "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/ocr/OCREngine.ts"
click node_scene_api "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/api/v1/see.py"
click node_scene_service "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/service.py"
click node_scene_blip "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/blip_describer.py"
click node_scene_cloud "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/cloud_vision.py"
click node_scene_heuristic "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/heuristic_describer.py"
click node_scene_translate "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/translator.py"
click node_scene_schema "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/schemas/scene.py"
click node_vqa_service "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/service.py"
click node_vqa_blip "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/blip_vqa.py"
click node_vqa_cloud "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/cloud_vqa.py"
click node_vqa_guard "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/guardrails.py"
click node_vqa_heuristic "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/heuristic_vqa.py"
click node_vqa_translate "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/translator.py"
click node_vqa_schema "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/schemas/vqa.py"
click node_api_router "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/api/v1/router.py"
click node_app_server "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/main.py"
click node_database "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/core/database.py"
click node_config "https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/core/config.py"
click node_aac_speech "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/speech/SpeechSynthesizer.ts"
click node_audio "https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/audio/AudioManager.ts"

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_see_view,node_express,node_speak,node_home,node_settings,node_camera,node_aac_speech,node_audio,node_user toneBlue
class node_detector,node_coco,node_detector_hook,node_ocr toneAmber
class node_scene_api,node_scene_service,node_scene_blip,node_scene_cloud,node_scene_heuristic,node_scene_translate,node_scene_schema,node_vqa_service,node_vqa_blip,node_vqa_cloud,node_vqa_guard,node_vqa_heuristic,node_vqa_translate,node_vqa_schema toneMint
class node_api_router,node_app_server,node_database,node_config toneRose
```

## Components

### Accessible client

- [Application shell](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [SEE workspace](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/see/SeeView.tsx): `frontend/src/modules/see/SeeView.tsx`
- [EXPRESS AAC](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/express/ExpressView.tsx): `frontend/src/modules/express/ExpressView.tsx`
- [SPEAK captions](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/speak/SpeakView.tsx): `frontend/src/modules/speak/SpeakView.tsx`
- [Home navigation](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/home/HomeView.tsx): `frontend/src/modules/home/HomeView.tsx`
- [Accessibility settings](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/modules/settings/SettingsView.tsx): `frontend/src/modules/settings/SettingsView.tsx`
- [Camera capture](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/camera/CameraManager.ts): `frontend/src/core/camera/CameraManager.ts`
- [Speech synthesis](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/speech/SpeechSynthesizer.ts): `frontend/src/core/speech/SpeechSynthesizer.ts`
- [Microphone capture](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/audio/AudioManager.ts): `frontend/src/core/audio/AudioManager.ts`

### SEE vision

- [Object detection](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/detector/DetectorEngine.ts): `frontend/src/core/detector/DetectorEngine.ts`
- [COCO labels](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/detector/cocoClasses.ts): `frontend/src/core/detector/cocoClasses.ts`
- [Detector lifecycle](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/detector/useDetector.ts): `frontend/src/core/detector/useDetector.ts`
- [OCR recognition](https://github.com/yashrajsahu44/saarthi/blob/main/frontend/src/core/ocr/OCREngine.ts): `frontend/src/core/ocr/OCREngine.ts`

### SEE services

- [SEE API routes](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/api/v1/see.py): `backend/app/api/v1/see.py`
- [Scene description](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/service.py): `backend/app/services/scene/service.py`
- [BLIP captioning](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/blip_describer.py): `backend/app/services/scene/blip_describer.py`
- [Cloud vision](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/cloud_vision.py): `backend/app/services/scene/cloud_vision.py`
- [Heuristic captioning](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/heuristic_describer.py): `backend/app/services/scene/heuristic_describer.py`
- [Scene translation](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/scene/translator.py): `backend/app/services/scene/translator.py`
- [Scene contract](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/schemas/scene.py): `backend/app/schemas/scene.py`
- [Visual Q&A](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/service.py): `backend/app/services/vqa/service.py`
- [BLIP visual Q&A](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/blip_vqa.py): `backend/app/services/vqa/blip_vqa.py`
- [Cloud visual Q&A](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/cloud_vqa.py): `backend/app/services/vqa/cloud_vqa.py`
- [Q&A guardrails](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/guardrails.py): `backend/app/services/vqa/guardrails.py`
- [Heuristic Q&A](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/heuristic_vqa.py): `backend/app/services/vqa/heuristic_vqa.py`
- [Answer translation](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/services/vqa/translator.py): `backend/app/services/vqa/translator.py`
- [Q&A contract](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/schemas/vqa.py): `backend/app/schemas/vqa.py`

### Backend platform

- [API router](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [FastAPI application](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/main.py): `backend/app/main.py`
- [Async database](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Runtime configuration](https://github.com/yashrajsahu44/saarthi/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Other components

- **Accessibility user**

## Connections

- Accessibility user → Application shell: opens
- Application shell → SEE workspace: offers module
- Application shell → EXPRESS AAC: offers module
- Application shell → SPEAK captions: offers module
- Application shell → Home navigation: offers navigation
- Application shell → Accessibility settings: offers settings
- SEE workspace → Camera capture: captures view
- Object detection → COCO labels: uses labels (evidence: `frontend/src/core/detector/DetectorEngine.ts`)
- Detector lifecycle → Object detection: runs inference (evidence: `frontend/src/core/detector/useDetector.ts`)
- SEE workspace → Detector lifecycle: uses detection
- SEE workspace → OCR recognition: reads documents
- SEE workspace → SEE API routes: requests scene
- SEE API routes → Scene description: requests description (evidence: `backend/app/api/v1/see.py`)
- SEE API routes → Visual Q&A: requests answer (evidence: `backend/app/api/v1/see.py`)
- Scene description → Cloud vision: tries cloud (evidence: `backend/app/services/scene/service.py`)
- Scene description → BLIP captioning: selects provider (evidence: `backend/app/services/scene/service.py`)
- Scene description → Heuristic captioning: falls back (evidence: `backend/app/services/scene/service.py`)
- Scene description → Scene contract: returns payload (evidence: `backend/app/services/scene/service.py`)
- Visual Q&A → Q&A guardrails: checks question (evidence: `backend/app/services/vqa/service.py`)
- Visual Q&A → Cloud visual Q&A: tries cloud (evidence: `backend/app/services/vqa/service.py`)
- Visual Q&A → BLIP visual Q&A: selects provider (evidence: `backend/app/services/vqa/service.py`)
- Visual Q&A → Heuristic Q&A: falls back (evidence: `backend/app/services/vqa/service.py`)
- Visual Q&A → Q&A contract: returns payload (evidence: `backend/app/services/vqa/service.py`)
- BLIP captioning → Scene translation: translates output (evidence: `backend/app/services/scene/blip_describer.py`)
- Cloud vision → Scene translation: translates output (evidence: `backend/app/services/scene/cloud_vision.py`)
- BLIP visual Q&A → Answer translation: translates answer (evidence: `backend/app/services/vqa/blip_vqa.py`)
- Cloud visual Q&A → Answer translation: translates answer (evidence: `backend/app/services/vqa/cloud_vqa.py`)
- FastAPI application → API router: mounts routes (evidence: `backend/app/main.py`)
- API router → SEE API routes: registers routes (evidence: `backend/app/api/v1/router.py`)
- FastAPI application → Async database: initializes lifecycle (evidence: `backend/app/main.py`)
- Async database → Runtime configuration: reads settings (evidence: `backend/app/core/database.py`)
- EXPRESS AAC → Speech synthesis: speaks phrases
- SPEAK captions → Microphone capture: captures speech
