As a non-German speaker living in Switzerland, I often need to quickly translate large texts, but I get annoyed by character limits on Google Translate or DeepL. Learning German may have been a way better call, but instead I decided to deploy a translation application. It's made of 3 containerized microservices:
- A Flask frontend to get inputs and display translations
- A FastAPI API backend to translate English text, using open-source models (SpaCy, Hugging Face)
- A MySQL database to store previous translations
In this repo, we deploy the app on Kubernetes cluster, see also this blog post.
For the deployment on a single node with Docker Compose, see this repo and this blog post.
Run the following commands in your Kubernetes cluster:
- Create the secrets for the database's credentials:
kubectl create secret generic mysql-db-secret \
--from-literal=MYSQL_ROOT_PASSWORD='<root_password>' \
--from-literal=MYSQL_USER='<user>' \
--from-literal=MYSQL_PASSWORD='<password>'
- Deploy the app
kubectl apply -f unlimited-translation-k8s-dev.yaml
- Connect to the app through the IP of the
frontend-flask-service
Service:
kubectl get svc -o wide
Note 1: the manifest used in the above command requests a LoadBalancer
service and an automatically provisioned PersistentVolume
, so it is expected to be applied on a cluster managed by a cloud provider (unless you implemented these features yourself... I used GKE).
Note 2: the unlimited-translation-k8s.yaml
contains an additional Ingress to publish the app on my personal domain, translate.vlgdata.io