A FastAPI-based translation service that translates English text to Vietnamese using the MarianMT model.
- English to Vietnamese translation
- RESTful API endpoints
- Docker containerization
- Automatic model downloading and caching
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
uvicorn app.api:app --reloaddocker build -t translation-api .
docker run -p 8000:8000 translation-apiTranslates English text to Vietnamese.
Request body:
{
"text": "Hello, how are you?"
}Response:
{
"translated_text": "Xin chào, bạn khỏe không?"
}Health check endpoint.
Response:
{
"status": "healthy"
}Once the application is running, you can access the API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc