Spaces:
Running
Running
Daryl Lim Claude Opus 4.6 (1M context) commited on
Commit ·
facc74d
1
Parent(s): 83587df
docs: update architecture description and test counts
Browse filesReflect two-column layout, searchable dropdown, locale codes, character
count, clear button, and Ctrl+Enter in CLAUDE.md. Update test counts
to 38 total (28 fast, 10 slow) in both CLAUDE.md and README.md.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 layout: a
|
| 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 two-column layout: left column has an "English" label, input textbox, and live character count; right column has a searchable target language dropdown (with locale codes, e.g., "French (fr)") and output textbox. Below are Clear and Translate buttons. 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/`** — 38 tests (28 fast, 10 slow). `test_langmap.py` has 8 fast tests for language mapping validation. `test_app.py` has 20 fast tests (signatures, device fallback, UI layout including clear button, character count, placeholder, 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 |
|
README.md
CHANGED
|
@@ -38,6 +38,6 @@ The Gradio interface launches at `http://localhost:7860`.
|
|
| 38 |
ruff check . # lint
|
| 39 |
ruff format . # format
|
| 40 |
ty check # type check
|
| 41 |
-
pytest -m "not slow" #
|
| 42 |
-
pytest # all
|
| 43 |
```
|
|
|
|
| 38 |
ruff check . # lint
|
| 39 |
ruff format . # format
|
| 40 |
ty check # type check
|
| 41 |
+
pytest -m "not slow" # 28 fast tests
|
| 42 |
+
pytest # all 38 tests (slow require CUDA + model download)
|
| 43 |
```
|