Add local MarianMT translation service
This commit is contained in:
@@ -31,6 +31,27 @@ A step by step series of examples that tell you how to get a development env run
|
||||
npm start
|
||||
```
|
||||
|
||||
### Local MarianMT translation
|
||||
|
||||
The translation service is independent from the Node backend and provides `GET /health` and `POST /translate`.
|
||||
|
||||
1. Start it locally:
|
||||
```
|
||||
cd translation-service
|
||||
python3 -m venv .venv
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
.venv/bin/python server.py
|
||||
```
|
||||
2. Configure the Node backend:
|
||||
```
|
||||
TRANSLATION_PROVIDER=marian
|
||||
MARIAN_TRANSLATION_URL=http://127.0.0.1:8000
|
||||
```
|
||||
|
||||
With Docker Compose, the service runs as the internal `translation` service. Set `TRANSLATION_PROVIDER=marian` before running `docker compose up`. MarianMT models download only when first needed and are stored in the `translation-models` Docker volume.
|
||||
|
||||
Supported languages are English (`en`), Spanish (`es`), French (`fr`), Danish (`da`), and Arabic (`ar`). Non-English pairs translate through English. Keep the service on the internal Docker network; it has no public port mapping.
|
||||
|
||||
### API Documentation
|
||||
|
||||
Once the server is running, you can access the interactive API documentation powered by Swagger UI at:
|
||||
|
||||
Reference in New Issue
Block a user