Spaces:
Running
Running
Daryl Lim Claude Opus 4.6 commited on
Commit ·
9c55188
1
Parent(s): d70ed53
docs: add UI improvements design for sidebar + tabbed layout
Browse filesCo-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
.gitignore
CHANGED
|
@@ -9,8 +9,9 @@ __pycache__/
|
|
| 9 |
# Linting
|
| 10 |
.ruff_cache/
|
| 11 |
|
| 12 |
-
# Docs
|
| 13 |
-
docs/
|
|
|
|
| 14 |
|
| 15 |
# IDE / OS
|
| 16 |
.DS_Store
|
|
|
|
| 9 |
# Linting
|
| 10 |
.ruff_cache/
|
| 11 |
|
| 12 |
+
# Docs (ignore all except plans/)
|
| 13 |
+
docs/*
|
| 14 |
+
!docs/plans/
|
| 15 |
|
| 16 |
# IDE / OS
|
| 17 |
.DS_Store
|
docs/plans/2026-03-04-ui-improvements-design.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UI Improvements Design
|
| 2 |
+
|
| 3 |
+
## Goal
|
| 4 |
+
|
| 5 |
+
Improve the MADLAD-400 translation app UI to serve both as a research tool and a demo showcase, targeting the research community.
|
| 6 |
+
|
| 7 |
+
## Layout
|
| 8 |
+
|
| 9 |
+
Two-column design:
|
| 10 |
+
|
| 11 |
+
- **Left sidebar (~25%)**: Target language dropdown + generation parameters (always visible)
|
| 12 |
+
- **Main area (~75%)**: Tabbed interface with "Single" and "Batch" tabs
|
| 13 |
+
- **Header**: Title, description, and paper link across the top
|
| 14 |
+
|
| 15 |
+
## Sidebar — Generation Parameters
|
| 16 |
+
|
| 17 |
+
Target language dropdown (moved from main area) plus three generation parameters:
|
| 18 |
+
|
| 19 |
+
| Parameter | Control | Default | Range |
|
| 20 |
+
|---|---|---|---|
|
| 21 |
+
| Max new tokens | Slider | 512 | 1–1024 |
|
| 22 |
+
| Num beams | Slider | 1 | 1–10 |
|
| 23 |
+
| Temperature | Slider | 1.0 | 0.1–2.0 (step 0.1) |
|
| 24 |
+
|
| 25 |
+
All parameters pass directly to `model.generate()`.
|
| 26 |
+
|
| 27 |
+
## Single Translation Tab
|
| 28 |
+
|
| 29 |
+
Same as current UI, relocated into tabbed layout:
|
| 30 |
+
|
| 31 |
+
- Input textbox (English, 4 lines)
|
| 32 |
+
- Output textbox (read-only, 4 lines, copy button)
|
| 33 |
+
- Translate button
|
| 34 |
+
- 4 examples at the bottom
|
| 35 |
+
|
| 36 |
+
## Batch Translation Tab
|
| 37 |
+
|
| 38 |
+
- File upload accepting `.txt` and `.csv`
|
| 39 |
+
- `.txt`: one sentence per line
|
| 40 |
+
- `.csv`: expects a `text` column (other columns preserved)
|
| 41 |
+
- Downloadable output file
|
| 42 |
+
- `.txt` input -> `.txt` output (translated lines)
|
| 43 |
+
- `.csv` input -> `.csv` output with `translation` column appended
|
| 44 |
+
- Gradio progress bar for batch advancement
|
| 45 |
+
- No examples — format documented via placeholder text
|
| 46 |
+
|
| 47 |
+
## Error Handling
|
| 48 |
+
|
| 49 |
+
- **Empty input**: Disable Translate button when no input/file
|
| 50 |
+
- **Large batches**: Rely on HF Spaces GPU timeout; return partial results with warning if cut short
|
| 51 |
+
- **Invalid CSV**: Gradio error if `text` column missing
|
| 52 |
+
- **Temperature + beam search**: Show `gr.Info()` notice when `num_beams > 1` and temperature is non-default (temperature has no effect with beam search)
|
| 53 |
+
|
| 54 |
+
## Testing
|
| 55 |
+
|
| 56 |
+
**Fast tests** (no CUDA):
|
| 57 |
+
- UI structure: sidebar, tabs, all components render
|
| 58 |
+
- Batch parsing: `.txt` and `.csv` parsing (valid and invalid)
|
| 59 |
+
- Parameter validation: defaults and ranges
|
| 60 |
+
|
| 61 |
+
**Slow tests** (CUDA + model):
|
| 62 |
+
- Single translation with non-default generation params (e.g., `num_beams=4`)
|
| 63 |
+
- Batch translation with small `.txt` and `.csv` files
|
| 64 |
+
|
| 65 |
+
New tests added to existing `test_app.py` and `test_langmap.py`.
|