# quubble/galaxytranslator architecture

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

- Interactive diagram: https://gitdiagram.com/quubble/galaxytranslator
- Repository: https://github.com/quubble/galaxytranslator

## Overview

Galaxy Translator is a Streamlit web app for translating text with Meta’s pretrained NLLB-200 model. A user enters text and selects source and target languages; the app maps those selections to NLLB codes, tokenizes the input, generates a translation, and displays the decoded result. Model and tokenizer loading, language selection, inference, and presentation are all implemented in app.py. The README documents searchable language selection and CPU support; no separate speech workflow is implemented. Components share one source file, so the graph separates responsibilities rather than implying separate modules.

Main entry points: [`app.py`](https://github.com/quubble/galaxytranslator/blob/main/app.py) (Translation generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Streamlit interface"]
  node_interface["Text and language UI<br/>[app.py]"]
  node_language_codes["Language code map<br/>[app.py]"]
  node_result_card["Translation display<br/>[app.py]"]
end

subgraph group_setup["Model setup"]
  node_model_loader["Cached model loader<br/>[app.py]"]
  node_hf_model["Pretrained NLLB model"]
end

subgraph group_translation["Translation runtime"]
  node_tokenizer["NLLB tokenizer<br/>[app.py]"]
  node_inference["Translation generation<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"enters and selects"| node_interface
node_interface -->|"maps selections"| node_language_codes
node_interface -->|"submits text"| node_inference
node_model_loader -->|"loads pretrained weights"| node_hf_model
node_model_loader -->|"loads tokenizer"| node_tokenizer
node_inference -->|"tokenizes and decodes"| node_tokenizer
node_inference -->|"generates translation"| node_hf_model
node_inference -->|"displays translation"| node_result_card
node_result_card -->|"shows result"| node_user

click node_interface "https://github.com/quubble/galaxytranslator/blob/main/app.py"
click node_language_codes "https://github.com/quubble/galaxytranslator/blob/main/app.py"
click node_result_card "https://github.com/quubble/galaxytranslator/blob/main/app.py"
click node_model_loader "https://github.com/quubble/galaxytranslator/blob/main/app.py"
click node_tokenizer "https://github.com/quubble/galaxytranslator/blob/main/app.py"
click node_inference "https://github.com/quubble/galaxytranslator/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_interface,node_language_codes,node_result_card,node_user toneBlue
class node_model_loader,node_hf_model toneAmber
class node_tokenizer,node_inference toneMint
```

## Components

### Streamlit interface

- [Text and language UI](https://github.com/quubble/galaxytranslator/blob/main/app.py): `app.py`
- [Language code map](https://github.com/quubble/galaxytranslator/blob/main/app.py): `app.py`
- [Translation display](https://github.com/quubble/galaxytranslator/blob/main/app.py): `app.py`

### Model setup

- [Cached model loader](https://github.com/quubble/galaxytranslator/blob/main/app.py): `app.py`
- **Pretrained NLLB model**

### Translation runtime

- [NLLB tokenizer](https://github.com/quubble/galaxytranslator/blob/main/app.py): `app.py`
- [Translation generation](https://github.com/quubble/galaxytranslator/blob/main/app.py): `app.py`

### Other components

- **User**

## Connections

- User → Text and language UI: enters and selects (evidence: `app.py`)
- Text and language UI → Language code map: maps selections (evidence: `app.py`)
- Text and language UI → Translation generation: submits text (evidence: `app.py`)
- Cached model loader → Pretrained NLLB model: loads pretrained weights (evidence: `app.py`)
- Cached model loader → NLLB tokenizer: loads tokenizer (evidence: `app.py`)
- Translation generation → NLLB tokenizer: tokenizes and decodes (evidence: `app.py`)
- Translation generation → Pretrained NLLB model: generates translation (evidence: `app.py`)
- Translation generation → Translation display: displays translation (evidence: `app.py`)
- Translation display → User: shows result (evidence: `app.py`)
