Introducción
Instalar Libretranslate
Requisitos
Un servidor Ubuntu 24.04 con 4 GB de memoria
Pasos
Paso 1: Actualizar Ubuntu, instalar Python, instalar Libretranslate
Como tenemos una nueva instancia de Ubuntu, necesitamos realizar algunas actualizaciones:
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
Paso 2 - Ejecutar Libretranslate
libretranslate --disable-web-ui --host 0.0.0.0
Paso 3 - Traducción de prueba
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"