# tehzeb/ai-vision-console architecture

> Architecture diagram of the GitHub repository tehzeb/ai-vision-console, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tehzeb/ai-vision-console
- Repository: https://github.com/tehzeb/ai-vision-console

## Overview

AI Vision Console is a browser-based image-recognition app backed by FastAPI. Users submit images for OCR, object detection, or handwritten-digit classification; the backend decodes uploads, calls the corresponding model service, and returns recognition data and (where applicable) annotated images for display. OCR text can also be sent to offline speech synthesis. The custom digit model has a separate MNIST training workflow. The README documents UI capabilities beyond the sampled frontend excerpt; API and service links are based on sampled source, while UI details are documented capabilities.

Main entry points: [`backend/main.py`](https://github.com/tehzeb/ai-vision-console/blob/main/backend/main.py) (FastAPI Routes), [`backend/utils/image_utils.py`](https://github.com/tehzeb/ai-vision-console/blob/main/backend/utils/image_utils.py) (Upload Decoding), [`frontend/js/app.js`](https://github.com/tehzeb/ai-vision-console/blob/main/frontend/js/app.js) (Recognition UI), [`backend/services/ocr_service.py`](https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/ocr_service.py) (Text Recognition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Web Console"]
  node_frontend["Recognition UI<br/>[app.js]"]
  node_frontend_page["Console Page<br/>[index.html]"]
  node_theme["Themes and About<br/>[app.js]"]
end

subgraph group_api["API Orchestration"]
  node_api_server["FastAPI Routes<br/>[main.py]"]
  node_config["Runtime Settings<br/>[config.py]"]
end

subgraph group_recognition["Recognition Services"]
  node_ocr["Text Recognition<br/>[ocr_service.py]"]
  node_detection["Object Detection"]
  node_digit_service["Digit Inference<br/>[digit_service.py]"]
  node_tts["Speech Synthesis<br/>[tts_service.py]"]
end

subgraph group_models["Models and Image"]
  node_image_decode["Upload Decoding<br/>[image_utils.py]"]
  node_image_helpers["Image Annotation<br/>[image_utils.py]"]
  node_digit_model["DigitCNN<br/>[digit_cnn.py]"]
  node_weights[("Trained Weights")]
  node_trainer["MNIST Trainer"]
end

node_user(("Console User"))
node_mnist[("MNIST Dataset")]
node_easyocr["EasyOCR Engine"]
node_yolo["Ultralytics YOLO"]
node_speech_engine["pyttsx3 Engine"]
node_audio["WAV Response"]

node_user -->|"uses"| node_frontend
node_frontend_page -->|"hosts"| node_frontend
node_frontend -->|"controls"| node_theme
node_frontend -->|"requests"| node_api_server
node_api_server -->|"serves"| node_frontend_page
node_api_server -->|"reads settings"| node_config
node_api_server -->|"decodes upload"| node_image_decode
node_api_server -->|"calls OCR"| node_ocr
node_api_server -->|"calls detector"| node_detection
node_api_server -->|"calls inference"| node_digit_service
node_api_server -->|"calls synthesis"| node_tts
node_image_decode -->|"passes image"| node_ocr
node_image_decode -->|"passes image"| node_detection
node_image_decode -->|"passes image"| node_digit_service
node_ocr -->|"recognizes text"| node_easyocr
node_detection -->|"predicts objects"| node_yolo
node_ocr -->|"annotates results"| node_image_helpers
node_detection -->|"annotates results"| node_image_helpers
node_digit_service -->|"runs inference"| node_digit_model
node_digit_service -->|"loads weights"| node_weights
node_trainer -->|"loads data"| node_mnist
node_trainer -->|"trains architecture"| node_digit_model
node_trainer -->|"saves weights"| node_weights
node_tts -->|"synthesizes speech"| node_speech_engine
node_tts -->|"writes WAV"| node_audio
node_api_server -->|"returns audio"| node_audio

click node_frontend "https://github.com/tehzeb/ai-vision-console/blob/main/frontend/js/app.js"
click node_frontend_page "https://github.com/tehzeb/ai-vision-console/blob/main/frontend/index.html"
click node_theme "https://github.com/tehzeb/ai-vision-console/blob/main/frontend/js/app.js"
click node_api_server "https://github.com/tehzeb/ai-vision-console/blob/main/backend/main.py"
click node_config "https://github.com/tehzeb/ai-vision-console/blob/main/backend/config.py"
click node_image_decode "https://github.com/tehzeb/ai-vision-console/blob/main/backend/utils/image_utils.py"
click node_ocr "https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/ocr_service.py"
click node_detection "https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/detection_service.py"
click node_digit_service "https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/digit_service.py"
click node_tts "https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/tts_service.py"
click node_image_helpers "https://github.com/tehzeb/ai-vision-console/blob/main/backend/utils/image_utils.py"
click node_digit_model "https://github.com/tehzeb/ai-vision-console/blob/main/backend/models/digit_cnn.py"
click node_weights "https://github.com/tehzeb/ai-vision-console/tree/main/backend/models/saved"
click node_trainer "https://github.com/tehzeb/ai-vision-console/blob/main/backend/models/train_digit_model.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_frontend,node_frontend_page,node_theme,node_user toneBlue
class node_api_server,node_config,node_mnist toneAmber
class node_ocr,node_detection,node_digit_service,node_tts toneMint
class node_image_decode,node_image_helpers,node_digit_model,node_weights,node_trainer toneRose
class node_easyocr,node_yolo,node_speech_engine,node_audio toneIndigo
```

## Components

### Web Console

- [Recognition UI](https://github.com/tehzeb/ai-vision-console/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Console Page](https://github.com/tehzeb/ai-vision-console/blob/main/frontend/index.html): `frontend/index.html`
- [Themes and About](https://github.com/tehzeb/ai-vision-console/blob/main/frontend/js/app.js): `frontend/js/app.js`

### API Orchestration

- [FastAPI Routes](https://github.com/tehzeb/ai-vision-console/blob/main/backend/main.py): `backend/main.py`
- [Runtime Settings](https://github.com/tehzeb/ai-vision-console/blob/main/backend/config.py): `backend/config.py`

### Recognition Services

- [Text Recognition](https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/ocr_service.py): `backend/services/ocr_service.py`
- [Object Detection](https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/detection_service.py): `backend/services/detection_service.py`
- [Digit Inference](https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/digit_service.py): `backend/services/digit_service.py`
- [Speech Synthesis](https://github.com/tehzeb/ai-vision-console/blob/main/backend/services/tts_service.py): `backend/services/tts_service.py`

### Models and Image

- [Upload Decoding](https://github.com/tehzeb/ai-vision-console/blob/main/backend/utils/image_utils.py): `backend/utils/image_utils.py`
- [Image Annotation](https://github.com/tehzeb/ai-vision-console/blob/main/backend/utils/image_utils.py): `backend/utils/image_utils.py`
- [DigitCNN](https://github.com/tehzeb/ai-vision-console/blob/main/backend/models/digit_cnn.py): `backend/models/digit_cnn.py`
- [Trained Weights](https://github.com/tehzeb/ai-vision-console/tree/main/backend/models/saved): `backend/models/saved`
- [MNIST Trainer](https://github.com/tehzeb/ai-vision-console/blob/main/backend/models/train_digit_model.py): `backend/models/train_digit_model.py`

### Other components

- **Console User**
- **MNIST Dataset**
- **EasyOCR Engine**
- **Ultralytics YOLO**
- **pyttsx3 Engine**
- **WAV Response**

## Connections

- Console User → Recognition UI: uses
- Console Page → Recognition UI: hosts
- Recognition UI → Themes and About: controls
- Recognition UI → FastAPI Routes: requests
- FastAPI Routes → Console Page: serves
- FastAPI Routes → Runtime Settings: reads settings
- FastAPI Routes → Upload Decoding: decodes upload
- FastAPI Routes → Text Recognition: calls OCR
- FastAPI Routes → Object Detection: calls detector
- FastAPI Routes → Digit Inference: calls inference
- FastAPI Routes → Speech Synthesis: calls synthesis
- Upload Decoding → Text Recognition: passes image
- Upload Decoding → Object Detection: passes image
- Upload Decoding → Digit Inference: passes image
- Text Recognition → EasyOCR Engine: recognizes text
- Object Detection → Ultralytics YOLO: predicts objects
- Text Recognition → Image Annotation: annotates results
- Object Detection → Image Annotation: annotates results
- Digit Inference → DigitCNN: runs inference
- Digit Inference → Trained Weights: loads weights
- MNIST Trainer → MNIST Dataset: loads data
- MNIST Trainer → DigitCNN: trains architecture
- MNIST Trainer → Trained Weights: saves weights
- Speech Synthesis → pyttsx3 Engine: synthesizes speech
- Speech Synthesis → WAV Response: writes WAV
- FastAPI Routes → WAV Response: returns audio
