- Create a VM Instance from GCP
- SSH into your newly created instance
- Update OS packages:
sudo apt-get update - Install Git:
sudo apt install git - Clone App Repo:
git clone https://github.com/dlops-io/simple-translate.git cd simple-translate- Install Python PIP:
sudo apt install python3-pip - Install packages:
pip3 install --break-system-packages googletrans==4.0.0rc1 art(The --break-system-packages option is to allow us to install packages to the base python in the OS) Test out the translations: python3 cli.pypython3 cli.py -t "Good morning. It is a good morning for cheese." -s "en" -d "es"python3 cli.py -t "Good afternoon. Would you like some cheese?" -s "en" -d "fr"
Refer to language codes at the bottom of this page.
- Create a VM Instance from GCP
- SSH into your newly created instance
- Update OS packages:
sudo apt-get update - Install Git:
sudo apt install git - Clone App Repo:
git clone https://github.com/dlops-io/simple-translate.git cd simple-translate- Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh - Reload your shell or run:
source $HOME/.local/bin/env - Install python environment from pyproject.toml:
uv sync - Activate the newly created environment:
source .venv/bin/activate - Test out the translations:
python cli.pypython cli.py -t "Good morning. It is a good morning for cheese." -s "en" -d "es"python cli.py -t "Good afternoon. Would you like some cheese?" -s "en" -d "fr"
Refer to language codes at the bottom of this page.
- Have Docker Desktop installed
- Cloned this repository to your local machine with a terminal up and running
- Check that your Docker is running with the following command
docker run hello-world
Follow the instructions for your operating system.
If you already have a preferred text editor, skip this step.
- Run
docker container ls - Stop any container that is running
- Run
docker system prune - Run
docker image ls
- Clone or download from here
-
Inside the
simple-translatefolder create a file calledDockerfile -
Follow these steps to create a
Dockerfilestep by step (Do a Build + Run after each step):
Step 1:
We want to base our docker image from python:3.12-slim-bookworm the official Debian-hosted Python 3.12 image
# Use the official Debian-hosted Python image
FROM python:3.12-slim-bookworm
Step 2:
Add Entry point to /bin/bash
ENTRYPOINT [“/bin/bash”]
Step 3: Install uv & copy source code into the container
# Install uv
RUN pip install uv
# Copy the source code
COPY . ./
Step 4: Setup a virtual environment by running uv sync
RUN uv sync
Step 5: Automatically get into the virtual environment shell on startup
# Get into the uv virtual environment shell
CMD [“-c”, “source .venv/bin/activate && exec bash”]
Solution Dockerfile:
Dockerfile.txt
- In a terminal make sure you are the location of
simple-translateBuild the docker container by running docker build -t simple-translate -f Dockerfile .
Run the container using:
docker run --rm -ti simple-translateRunning the translate codepython cli.py -t "Good morning" -s "en" -d "es"To exit from container- Type
exitfrom the Docker shell
- Sign up in Docker Hub and create an Access Token
- Login to the Hub:
docker login -u <USER NAME> -p <ACCESS TOKEN> - Tag the Docker Image:
docker tag simple-translate <USER NAME>/simple-translate-ac215 - Push to Docker Hub:
docker push <USER NAME>/simple-translate-ac215
- Create a VM Instance from GCP
- SSH into your newly created instance Install Docker on the newly created instance by running
sudo apt install docker.io
Check version of installed Docker
sudo docker --version
Run the app using Dockersudo docker run --rm -ti dlops/simple-translate
Run the cli
python cli.py
| No. | Language Name | Native Language Name | Code |
| 1 | Afrikaans | Afrikaans | af |
| 2 | Albanian | Shqip | sq |
| 3 | Arabic | عربي | ar |
| 4 | Armenian | Հայերէն | hy |
| 5 | Azerbaijani | آذربایجان دیلی | az |
| 6 | Basque | Euskara | eu |
| 7 | Belarusian | Беларуская | be |
| 8 | Bulgarian | Български | bg |
| 9 | Catalan | Català | ca |
| 10 | Chinese (Simplified) | 中文简体 | zh-CN |
| 11 | Chinese (Traditional) | 中文繁體 | zh-TW |
| 12 | Croatian | Hrvatski | hr |
| 13 | Czech | Čeština | cs |
| 14 | Danish | Dansk | da |
| 15 | Dutch | Nederlands | nl |
| 16 | English | English | en |
| 17 | Estonian | Eesti keel | et |
| 18 | Filipino | Filipino | tl |
| 19 | Finnish | Suomi | fi |
| 20 | French | Français | fr |
| 21 | Galician | Galego | gl |
| 22 | Georgian | ქართული | ka |
| 23 | German | Deutsch | de |
| 24 | Greek | Ελληνικά | el |
| 25 | Haitian Creole | Kreyòl ayisyen | ht |
| 26 | Hebrew | עברית | iw |
| 27 | Hindi | हिन्दी | hi |
| 28 | Hungarian | Magyar | hu |
| 29 | Icelandic | Íslenska | is |
| 30 | Indonesian | Bahasa Indonesia | id |
| 31 | Irish | Gaeilge | ga |
| 32 | Italian | Italiano | it |
| 33 | Japanese | 日本語 | ja |
| 34 | Korean | 한국어 | ko |
| 35 | Latvian | Latviešu | lv |
| 36 | Lithuanian | Lietuvių kalba | lt |
| 37 | Macedonian | Македонски | mk |
| 38 | Malay | Malay | ms |
| 39 | Maltese | Malti | mt |
| 40 | Norwegian | Norsk | no |
| 41 | Persian | فارسی | fa |
| 42 | Polish | Polski | pl |
| 43 | Portuguese | Português | pt |
| 44 | Romanian | Română | ro |
| 45 | Russian | Русский | ru |
| 46 | Serbian | Српски | sr |
| 47 | Slovak | Slovenčina | sk |
| 48 | Slovenian | Slovensko | sl |
| 49 | Spanish | Español | es |
| 50 | Swahili | Kiswahili | sw |
| 51 | Swedish | Svenska | sv |
| 52 | Thai | ไทย | th |
| 53 | Turkish | Türkçe | tr |
| 54 | Ukrainian | Українська | uk |
| 55 | Urdu | اردو | ur |
| 56 | Vietnamese | Tiếng Việt | vi |
| 57 | Welsh | Cymraeg | cy |
| 58 | Yiddish | ייִדיש | yi |
- You can download a file from GCS using
[https://storage.googleapis.com/ac215-test-bucket/tips.txt](https://storage.googleapis.com/ac215-test-bucket/tip.txt)(path of file in GCS) - You can upload a file to GCS using
curl --upload-file tips2.txt https://storage.googleapis.com/ac215-test-bucket/(provided you have write access)