Spaces:
Running on Zero
Running on Zero
Daryl Lim commited on
Commit Β·
a52a55e
1
Parent(s): 90fc0f4
docs: update CLAUDE.md for Google Translate-style UI redesign
Browse files
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
|
| 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/`** β
|
| 40 |
|
| 41 |
## Tooling
|
| 42 |
|
|
|
|
| 32 |
|
| 33 |
## Architecture
|
| 34 |
|
| 35 |
+
**`app.py`** β Single-file application with a Google Translate-style layout: a centered language bar ("English β [Target]") above side-by-side input/output text areas and a translate button. 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/`** β 31 tests (21 fast, 10 slow). `test_langmap.py` has 8 fast tests for language mapping validation. `test_app.py` has 13 fast tests (signatures, device fallback, UI layout) 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 |
|