Introduction
Installer LibreTranslate
Exigences
Un serveur Ubuntu 24.04 avec 4 Go de mémoire
Mesures
Étape 1 - Mettre à jour Ubuntu, installer Python, installer LibreTranslate
Comme nous avons une nouvelle instance d'Ubuntu, nous devons effectuer quelques mises à jour :
apt-get update;
DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade
apt-get install -y vim curl;
apt-get install -y python3 python3-pip
apt-get install -y python3-venv python3-full
python3 -m venv libretranslate-env
source libretranslate-env/bin/activate
pip install libretranslate
Étape 2 - Lancer LibreTranslate
libretranslate --disable-web-ui --host 0.0.0.0
Étape 3 - Test de traduction
url -X POST -H "Content-Type: application/json" -d '{"q":["When a blind man cries", "She is the hero of the story"], "source":"en", "target":"zh-Hant"}' "http://localhost:5000/translate"