AI-Translates / README.md
jing-ju's picture
Update README.md
f381b1b verified
---
title: Hunyuan-MT Translation (Serverless)
emoji: 🌐
colorFrom: yellow
colorTo: blue
sdk: gradio
sdk_version: "4.44.0"
app_file: app.py
pinned: false
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
# Hunyuan-MT Translation (Hugging Face Space - Free CPU)
Demo dịch đa ngôn ngữ dùng mô hình **Tencent Hunyuan-MT** thông qua **Hugging Face Serverless Inference API**, chạy được trên **Space CPU (free)** — không cần GPU.
## Tính năng
- Chọn mô hình:
- `tencent/Hunyuan-MT-7B-fp8` (khuyến nghị cho serverless)
- `tencent/Hunyuan-MT-7B`
- Hỗ trợ 30+ ngôn ngữ (bao gồm `zh`, `zh-Hant`, `yue`, `en`, `vi`, …).
- Prompt theo gợi ý từ model card:
- **ZH ⇄ XX**: `把下面的文本翻译成<target_language>,不要额外解释。`
- **XX ⇄ XX**: `Translate the following segment into <target_language>, without additional explanation.`
## Triển khai
1. Tạo Space mới (Python) và chọn **Hardware: CPU Basic (Free)**.
2. Commit 3 file: `app.py`, `requirements.txt`, `README.md`.
3. (Khuyến nghị) Vào **Settings → Repository secrets** thêm:
- `HF_TOKEN`: token Hugging Face để tăng hạn mức Inference API.
4. **Restart** Space sau khi commit.
## Biến môi trường (tùy chọn)
- `HYMT_MODEL`: đổi mô hình mặc định (mặc định: `tencent/Hunyuan-MT-7B-fp8`).
- `HF_TOKEN`: token truy cập Hugging Face (giúp tránh rate-limit ẩn danh).
## Ghi chú kỹ thuật
- Ứng dụng gọi **Serverless Inference API** qua `huggingface_hub.InferenceClient.text_generation(...)` nên **không cần** tải checkpoint nặng.
- Nếu muốn tự tải model và suy luận nội bộ (TGI/vLLM), cần GPU; CPU free không phù hợp.
## Giấy phép & trách nhiệm
- Tuân thủ giấy phép của mô hình và chính sách sử dụng của Hugging Face.