Einführung
Installieren Sie LibreTranslate.
Anforderungen
Ein Ubuntu 24.04 Server mit 4 GB Arbeitsspeicher
Schritte
Schritt 1 – Ubuntu aktualisieren, Python installieren, LibreTranslate installieren
Da wir eine neue Ubuntu-Instanz haben, müssen wir einige Aktualisierungen vornehmen:
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
Schritt 2 – LibreTranslate ausführen
libretranslate --disable-web-ui --host 0.0.0.0
Schritt 3 – Übersetzung testen
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"