Daryl Lim commited on
Commit
2f45b6a
·
1 Parent(s): 9d3984a

docs: update architecture for layout alignment changes

Browse files
Files changed (1) hide show
  1. CLAUDE.md +2 -2
CLAUDE.md CHANGED
@@ -32,11 +32,11 @@ pytest -m slow # model tests only (CUDA only)
32
 
33
  ## Architecture
34
 
35
- **`app.py`** — Single-file application with a Google Translate-style two-column layout: left column has a static "English" dropdown, input textbox with inline clear button, a `gr.HTML` element showing a keyboard shortcut hint and live character count (`Press Ctrl+Enter to apply · X / 2,000`), and the Translate button (shows "Translating..." during processing); right column has a searchable target language dropdown (with locale codes, e.g., "French (fr)") and output textbox with copy button. Ctrl+Enter submits from the input. Uses `@lru_cache` for lazy loading of the `google/madlad400-3b-mt` tokenizer and model (no download on import). Uses `float16` on CUDA, `float32` on CPU. MPS is not supported (produces garbage output with T5 models). Translation prepends a language token with a space to the input text (e.g., `<2fr> Hello`) before tokenization and generation. The `@spaces.GPU` decorator allocates GPU on HF Spaces infrastructure.
36
 
37
  **`langmap/`** — Package with `langid_mapping.py`, a hand-maintained dictionary mapping 22 Tier 1 production-ready language tokens (BLEU 35+ both directions, Section A.10) to human-readable language names. Available languages at runtime are the intersection of this mapping and the model's vocabulary.
38
 
39
- **`tests/`** — 45 tests (35 fast, 10 slow). `test_langmap.py` has 8 fast tests for language mapping validation. `test_app.py` has 27 fast tests (signatures, device fallback, UI layout including English dropdown, textbox height, inline clear, character count in HTML element, shortcut hint in HTML element, translate button in input column, filterable dropdown, locale codes, no title) and 10 slow tests (translation with various parameters, language mapping). Slow tests require CUDA and model download; auto-skipped without CUDA.
40
 
41
  ## Tooling
42
 
 
32
 
33
  ## Architecture
34
 
35
+ **`app.py`** — Single-file application with a Google Translate-style two-column layout: left column has a static "English" dropdown and input textbox with inline clear button; right column has a searchable target language dropdown (with locale codes, e.g., "French (fr)") and output textbox with copy button. The Translate button spans full width below both columns (shows "Translating..." during processing). Ctrl+Enter submits from the input. Uses `@lru_cache` for lazy loading of the `google/madlad400-3b-mt` tokenizer and model (no download on import). Uses `float16` on CUDA, `float32` on CPU. MPS is not supported (produces garbage output with T5 models). Translation prepends a language token with a space to the input text (e.g., `<2fr> Hello`) before tokenization and generation. The `@spaces.GPU` decorator allocates GPU on HF Spaces infrastructure.
36
 
37
  **`langmap/`** — Package with `langid_mapping.py`, a hand-maintained dictionary mapping 22 Tier 1 production-ready language tokens (BLEU 35+ both directions, Section A.10) to human-readable language names. Available languages at runtime are the intersection of this mapping and the model's vocabulary.
38
 
39
+ **`tests/`** — 41 tests (31 fast, 10 slow). `test_langmap.py` has 8 fast tests for language mapping validation. `test_app.py` has 23 fast tests (signatures, device fallback, UI layout including English dropdown, textbox height, inline clear, filterable dropdown, locale codes, no title) and 10 slow tests (translation with various parameters, language mapping). Slow tests require CUDA and model download; auto-skipped without CUDA.
40
 
41
  ## Tooling
42