# chhssmch/nihao-chinese-ml architecture

> Architecture diagram of the GitHub repository chhssmch/nihao-chinese-ml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chhssmch/nihao-chinese-ml
- Repository: https://github.com/chhssmch/nihao-chinese-ml

## Overview

NiHao is a Django-based Chinese-learning application with four ML workflows: text translation, Chinese speech transcription, image object recognition, and video object analysis. Users submit text or media through dedicated web views; those views call task-specific inference modules and render results in the corresponding interface. Text translation also has a documented FastAPI interface. The video analyzer reuses image detection’s cached YOLO model and Chinese label dictionary. Connections are limited to calls shown in excerpts or capabilities and entry points stated in the README; the overall Django URL mounting and unsampled internals are not expanded.

Main entry points: [`NiHao/urls.py`](https://github.com/chhssmch/nihao-chinese-ml/blob/master/NiHao/urls.py) (Django routes), [`ml_image/views.py`](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/views.py) (Image upload view), [`ml_video/views.py`](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/views.py) (Video upload view), [`ml_text/views.py`](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/views.py) (Translation view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interfaces"]
  node_django_routes["Django routes<br/>[urls.py]"]
  node_text_view["Translation view<br/>[views.py]"]
  node_audio_view["Transcription view<br/>[views.py]"]
  node_image_view["Image upload view<br/>[views.py]"]
  node_video_view["Video upload view<br/>[views.py]"]
  node_text_ui["Translation page<br/>[translate.html]"]
  node_audio_ui["Transcription page<br/>[transcribe.html]"]
  node_image_ui["Recognition page<br/>[recognize.html]"]
  node_video_ui["Analysis page<br/>[analyze.html]"]
end

subgraph group_text["Text translation"]
  node_text_engine["Translation engine<br/>[main.py]"]
  node_text_api["Translation API<br/>[api_views.py]"]
end

subgraph group_audio["Speech recognition"]
  node_audio_engine["Whisper transcription<br/>[main.py]"]
end

subgraph group_vision["Visual learning"]
  node_image_engine["YOLO detection<br/>[main.py]"]
  node_image_results["Annotated image<br/>[views.py]"]
  node_video_engine["Video analyzer<br/>[main.py]"]
  node_video_results["Video summary<br/>[views.py]"]
end

node_learner(("Learner"))

node_learner -.->|"requests pages"| node_django_routes
node_django_routes -.->|"routes request"| node_text_view
node_django_routes -.->|"routes request"| node_audio_view
node_django_routes -.->|"routes request"| node_image_view
node_django_routes -.->|"routes request"| node_video_view
node_text_view -->|"translates text"| node_text_engine
node_text_api -->|"translates text"| node_text_engine
node_audio_view -->|"transcribes audio"| node_audio_engine
node_image_view -->|"detects objects"| node_image_engine
node_image_view -->|"renders result"| node_image_results
node_video_view -->|"analyzes video"| node_video_engine
node_video_engine -->|"reuses detector"| node_image_engine
node_video_view -->|"renders summary"| node_video_results
node_text_view -->|"renders page"| node_text_ui
node_audio_view -->|"renders page"| node_audio_ui
node_image_view -->|"renders page"| node_image_ui
node_video_view -->|"renders page"| node_video_ui

click node_django_routes "https://github.com/chhssmch/nihao-chinese-ml/blob/master/NiHao/urls.py"
click node_text_view "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/views.py"
click node_audio_view "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_audio/views.py"
click node_image_view "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/views.py"
click node_video_view "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/views.py"
click node_text_ui "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/templates/ml_text/translate.html"
click node_audio_ui "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_audio/templates/ml_audio/transcribe.html"
click node_image_ui "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/templates/ml_image/recognize.html"
click node_video_ui "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/templates/ml_video/analyze.html"
click node_text_engine "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/main.py"
click node_text_api "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/api_views.py"
click node_audio_engine "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_audio/main.py"
click node_image_engine "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/main.py"
click node_image_results "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/views.py"
click node_video_engine "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/main.py"
click node_video_results "https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/views.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_django_routes,node_text_view,node_audio_view,node_image_view,node_video_view,node_text_ui,node_audio_ui,node_image_ui,node_video_ui toneBlue
class node_text_engine,node_text_api toneAmber
class node_audio_engine toneMint
class node_image_engine,node_image_results,node_video_engine,node_video_results toneRose
class node_learner toneIndigo
```

## Components

### Web interfaces

- [Django routes](https://github.com/chhssmch/nihao-chinese-ml/blob/master/NiHao/urls.py): `NiHao/urls.py`
- [Translation view](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/views.py): `ml_text/views.py`
- [Transcription view](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_audio/views.py): `ml_audio/views.py`
- [Image upload view](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/views.py): `ml_image/views.py`
- [Video upload view](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/views.py): `ml_video/views.py`
- [Translation page](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/templates/ml_text/translate.html): `ml_text/templates/ml_text/translate.html`
- [Transcription page](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_audio/templates/ml_audio/transcribe.html): `ml_audio/templates/ml_audio/transcribe.html`
- [Recognition page](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/templates/ml_image/recognize.html): `ml_image/templates/ml_image/recognize.html`
- [Analysis page](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/templates/ml_video/analyze.html): `ml_video/templates/ml_video/analyze.html`

### Text translation

- [Translation engine](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/main.py): `ml_text/main.py`
- [Translation API](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_text/api_views.py): `ml_text/api_views.py`

### Speech recognition

- [Whisper transcription](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_audio/main.py): `ml_audio/main.py`

### Visual learning

- [YOLO detection](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/main.py): `ml_image/main.py`
- [Annotated image](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_image/views.py): `ml_image/views.py`
- [Video analyzer](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/main.py): `ml_video/main.py`
- [Video summary](https://github.com/chhssmch/nihao-chinese-ml/blob/master/ml_video/views.py): `ml_video/views.py`

### Other components

- **Learner**

## Connections

- Learner → Django routes: requests pages
- Django routes → Translation view: routes request
- Django routes → Transcription view: routes request
- Django routes → Image upload view: routes request
- Django routes → Video upload view: routes request
- Translation view → Translation engine: translates text (evidence: `ml_text/views.py`)
- Translation API → Translation engine: translates text (evidence: `ml_text/api_views.py`)
- Transcription view → Whisper transcription: transcribes audio (evidence: `ml_audio/views.py`)
- Image upload view → YOLO detection: detects objects (evidence: `ml_image/views.py`)
- Image upload view → Annotated image: renders result (evidence: `ml_image/views.py`)
- Video upload view → Video analyzer: analyzes video (evidence: `ml_video/views.py`)
- Video analyzer → YOLO detection: reuses detector (evidence: `ml_video/main.py`)
- Video upload view → Video summary: renders summary (evidence: `ml_video/views.py`)
- Translation view → Translation page: renders page (evidence: `ml_text/views.py`)
- Transcription view → Transcription page: renders page (evidence: `ml_audio/views.py`)
- Image upload view → Recognition page: renders page (evidence: `ml_image/views.py`)
- Video upload view → Analysis page: renders page (evidence: `ml_video/views.py`)
