|
Download README.md from CVNSS/dich: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/CVNSS/dich/resolve/main/README.md
- Command line
-
hf download hf://spaces/CVNSS/dich/README.md
-
curl -L -o README.md https://huggingface.co/spaces/CVNSS/dich/resolve/main/README.md
1.99 kB
| title: Bila Translator Realtime | |
| emoji: ⚡ | |
| colorFrom: blue | |
| colorTo: green | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| license: mit | |
| # Bila Translator Realtime · Hugging Face Space | |
| Ứng dụng dịch song song 6 ô: Tiếng Việt, CVNSS4.0, English, 中文, ພາສາລາວ, ភាសាខ្មែរ. | |
| ## Kiến trúc | |
| - Frontend tĩnh chạy cực nhẹ, CVNSS4.0 xử lý cục bộ trong browser. | |
| - FastAPI proxy tại `/api/translate` để tránh CORS và gom cache RAM. | |
| - Cache 2 tầng: localStorage trong browser + TTL cache trong backend. | |
| - Service Worker cache app shell để mở lại nhanh như offline. | |
| ## Biến môi trường tuỳ chọn | |
| | Tên | Mặc định | Ý nghĩa | | |
| |---|---:|---| | |
| | `TRANSLATE_API_BASE` | `https://dichmay.itrithuc.vn:1721` | API dịch upstream | | |
| | `TRANSLATE_VERIFY_SSL` | `true` | Đặt `false` nếu upstream dùng chứng chỉ lỗi | | |
| | `MAX_CHARS` | `12000` | Giới hạn ký tự mỗi lượt | | |
| | `CACHE_TTL_SEC` | `86400` | TTL cache backend | | |
| | `CACHE_MAX_ITEMS` | `4096` | Số bản dịch cache tối đa | | |
| ## Chạy local | |
| ```bash | |
| pip install -r requirements.txt | |
| uvicorn app:app --host 0.0.0.0 --port 7860 --reload | |
| ``` | |
| Mở: <http://localhost:7860> | |
| ## Đưa lên Hugging Face Spaces | |
| Tạo Space mới với SDK `Docker`, sau đó copy toàn bộ file trong thư mục này lên repo Space và `git push`. | |
| ## Queue-safe mode | |
| This build is patched for upstream queues that return messages such as “Vị trí yêu cầu trong hàng chờ dịch” and “Thời gian chờ ước tính”. | |
| Recommended Hugging Face Space variables: | |
| ```text | |
| MAX_UPSTREAM_CONCURRENCY=2 | |
| TRANSLATE_TIMEOUT_SEC=65 | |
| POLL_MIN_DELAY_SEC=0.35 | |
| POLL_MAX_DELAY_SEC=4.0 | |
| ``` | |
| Why: browser aborts do not always cancel a translation task that has already been created on the upstream service. The app therefore avoids creating a fresh upstream task for every keystroke and backs off when the upstream queue reports an estimated wait. | |