# khushi-070906/dwani architecture

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

- Interactive diagram: https://gitdiagram.com/khushi-070906/dwani
- Repository: https://github.com/khushi-070906/dwani

## Overview

LDST/DwaniLive is a local-network speech-translation host: a presenter streams microphone audio, the server segments and transcribes it, translates for each subscribed language, and broadcasts captions to attendees. The README also documents reverse-direction Q&A, optional glossary adaptation and semantic caching, accessibility settings, and a desktop app. The graph follows the README and source-index references; some implementation excerpts are partial or unavailable, so uncertain wiring is omitted.

Main entry points: [`server.py`](https://github.com/khushi-070906/dwani/blob/main/server.py) (Session server), [`gui.py`](https://github.com/khushi-070906/dwani/blob/main/gui.py) (Desktop app), [`decision_engine.py`](https://github.com/khushi-070906/dwani/blob/main/decision_engine.py) (Translation decision), [`pipeline.py`](https://github.com/khushi-070906/dwani/blob/main/pipeline.py) (Audio segmentation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hosting["Session hosting"]
  node_host["Session server<br/>[server.py]"]
  node_session["Session state<br/>[session.py]"]
  node_captions["Caption delivery<br/>[server.py]"]
end

subgraph group_translation["Speech translation"]
  node_audio["Audio segmentation<br/>[pipeline.py]"]
  node_asr["Whisper ASR<br/>[backends.py]"]
  node_translator["NLLB translation<br/>[backends.py]"]
  node_tokenizer["NLLB tokenizer<br/>[nllb_tokenizer.py]"]
end

subgraph group_extensions["Translation extensions"]
  node_semantic_cache[("Semantic cache")]
  node_decision["Translation decision<br/>[decision_engine.py]"]
  node_glossary["Glossary adaptation<br/>[glossary.py]"]
  node_dynamic_glossary["Dynamic glossary"]
  node_memory[("Persistent memory")]
end

subgraph group_interaction["Attendee interaction"]
  node_attendee_client["Attendee client"]
  node_qa["Reverse Q&amp;A<br/>[qa_pipeline.py]"]
  node_accessibility["Accessibility settings<br/>[accessibility.py]"]
end

subgraph group_desktop["Desktop and licensing"]
  node_desktop["Desktop app<br/>[gui.py]"]
  node_environment["Runtime environment<br/>[appenv.py]"]
  node_licensing["License enforcement<br/>[licensing.py]"]
  node_license_service["License service<br/>[license_server.py]"]
end

node_presenter(("Presenter"))
node_attendees(("Attendees"))

node_presenter -->|"starts session"| node_host
node_attendees -->|"join locally"| node_host
node_host -->|"manages session"| node_session
node_presenter -->|"streams audio"| node_audio
node_host -->|"segments audio"| node_audio
node_audio -->|"transcribes segments"| node_asr
node_host -->|"translates languages"| node_translator
node_translator -.->|"uses tokenizer"| node_tokenizer
node_host -->|"broadcasts captions"| node_captions
node_captions -->|"streams captions"| node_attendee_client
node_attendees -->|"selects language"| node_attendee_client
node_host -->|"routes questions"| node_qa
node_attendees -->|"submits question"| node_qa
node_host -->|"reports settings"| node_accessibility
node_host -->|"configures decisions"| node_decision
node_decision -->|"checks translations"| node_semantic_cache
node_decision -->|"checks terminology"| node_glossary
node_host -->|"configures glossary"| node_glossary
node_host -->|"configures adaptation"| node_dynamic_glossary
node_host -->|"configures memory"| node_memory
node_desktop -->|"launches server"| node_host
node_desktop -->|"uses runtime paths"| node_environment
node_desktop -->|"checks license"| node_licensing
node_license_service -.->|"issues licenses"| node_licensing

click node_host "https://github.com/khushi-070906/dwani/blob/main/server.py"
click node_session "https://github.com/khushi-070906/dwani/blob/main/session.py"
click node_audio "https://github.com/khushi-070906/dwani/blob/main/pipeline.py"
click node_asr "https://github.com/khushi-070906/dwani/blob/main/backends.py"
click node_translator "https://github.com/khushi-070906/dwani/blob/main/backends.py"
click node_tokenizer "https://github.com/khushi-070906/dwani/blob/main/nllb_tokenizer.py"
click node_captions "https://github.com/khushi-070906/dwani/blob/main/server.py"
click node_qa "https://github.com/khushi-070906/dwani/blob/main/qa_pipeline.py"
click node_accessibility "https://github.com/khushi-070906/dwani/blob/main/accessibility.py"
click node_semantic_cache "https://github.com/khushi-070906/dwani/blob/main/translation_cache.py"
click node_decision "https://github.com/khushi-070906/dwani/blob/main/decision_engine.py"
click node_glossary "https://github.com/khushi-070906/dwani/blob/main/glossary.py"
click node_dynamic_glossary "https://github.com/khushi-070906/dwani/blob/main/dynamic_glossary.py"
click node_memory "https://github.com/khushi-070906/dwani/blob/main/persistent_memory.py"
click node_desktop "https://github.com/khushi-070906/dwani/blob/main/gui.py"
click node_environment "https://github.com/khushi-070906/dwani/blob/main/appenv.py"
click node_licensing "https://github.com/khushi-070906/dwani/blob/main/licensing.py"
click node_license_service "https://github.com/khushi-070906/dwani/blob/main/license_server.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_host,node_session,node_captions toneBlue
class node_audio,node_asr,node_translator,node_tokenizer toneAmber
class node_semantic_cache,node_decision,node_glossary,node_dynamic_glossary,node_memory toneMint
class node_attendee_client,node_qa,node_accessibility toneRose
class node_desktop,node_environment,node_licensing,node_license_service,node_presenter,node_attendees toneIndigo
```

## Components

### Session hosting

- [Session server](https://github.com/khushi-070906/dwani/blob/main/server.py): `server.py`
- [Session state](https://github.com/khushi-070906/dwani/blob/main/session.py): `session.py`
- [Caption delivery](https://github.com/khushi-070906/dwani/blob/main/server.py): `server.py`

### Speech translation

- [Audio segmentation](https://github.com/khushi-070906/dwani/blob/main/pipeline.py): `pipeline.py`
- [Whisper ASR](https://github.com/khushi-070906/dwani/blob/main/backends.py): `backends.py`
- [NLLB translation](https://github.com/khushi-070906/dwani/blob/main/backends.py): `backends.py`
- [NLLB tokenizer](https://github.com/khushi-070906/dwani/blob/main/nllb_tokenizer.py): `nllb_tokenizer.py`

### Translation extensions

- [Semantic cache](https://github.com/khushi-070906/dwani/blob/main/translation_cache.py): `translation_cache.py`
- [Translation decision](https://github.com/khushi-070906/dwani/blob/main/decision_engine.py): `decision_engine.py`
- [Glossary adaptation](https://github.com/khushi-070906/dwani/blob/main/glossary.py): `glossary.py`
- [Dynamic glossary](https://github.com/khushi-070906/dwani/blob/main/dynamic_glossary.py): `dynamic_glossary.py`
- [Persistent memory](https://github.com/khushi-070906/dwani/blob/main/persistent_memory.py): `persistent_memory.py`

### Attendee interaction

- **Attendee client**
- [Reverse Q&A](https://github.com/khushi-070906/dwani/blob/main/qa_pipeline.py): `qa_pipeline.py`
- [Accessibility settings](https://github.com/khushi-070906/dwani/blob/main/accessibility.py): `accessibility.py`

### Desktop and licensing

- [Desktop app](https://github.com/khushi-070906/dwani/blob/main/gui.py): `gui.py`
- [Runtime environment](https://github.com/khushi-070906/dwani/blob/main/appenv.py): `appenv.py`
- [License enforcement](https://github.com/khushi-070906/dwani/blob/main/licensing.py): `licensing.py`
- [License service](https://github.com/khushi-070906/dwani/blob/main/license_server.py): `license_server.py`

### Other components

- **Presenter**
- **Attendees**

## Connections

- Presenter → Session server: starts session (evidence: `README.md`)
- Attendees → Session server: join locally (evidence: `README.md`)
- Session server → Session state: manages session (evidence: `server.py`)
- Presenter → Audio segmentation: streams audio (evidence: `README.md`)
- Session server → Audio segmentation: segments audio (evidence: `README.md`)
- Audio segmentation → Whisper ASR: transcribes segments (evidence: `README.md`)
- Session server → NLLB translation: translates languages (evidence: `README.md`)
- NLLB translation → NLLB tokenizer: uses tokenizer (evidence: `backends.py`)
- Session server → Caption delivery: broadcasts captions (evidence: `README.md`)
- Caption delivery → Attendee client: streams captions (evidence: `README.md`)
- Attendees → Attendee client: selects language (evidence: `README.md`)
- Session server → Reverse Q&A: routes questions (evidence: `server.py`)
- Attendees → Reverse Q&A: submits question (evidence: `README.md`)
- Session server → Accessibility settings: reports settings (evidence: `server.py`)
- Session server → Translation decision: configures decisions (evidence: `decision_engine.py`)
- Translation decision → Semantic cache: checks translations (evidence: `decision_engine.py`)
- Translation decision → Glossary adaptation: checks terminology (evidence: `decision_engine.py`)
- Session server → Glossary adaptation: configures glossary (evidence: `server.py`)
- Session server → Dynamic glossary: configures adaptation (evidence: `server.py`)
- Session server → Persistent memory: configures memory (evidence: `server.py`)
- Desktop app → Session server: launches server (evidence: `gui.py`)
- Desktop app → Runtime environment: uses runtime paths (evidence: `appenv.py`)
- Desktop app → License enforcement: checks license (evidence: `gui.py`)
- License service → License enforcement: issues licenses (evidence: `license_server.py`)
