Offine-Text-Translate Local Offline Text Translation OTT
Supports multi-language local offline text translation, providing an API interface.
This project is a re-encapsulation based on the open-source project LibreTranslate. The purpose is to provide an easy-to-deploy translation API service directly on a local machine, without Docker, and provides a pre-compiled Windows EXE package that can be used by double-clicking without deployment, making it convenient for beginners and novices.
The first startup requires downloading the model, and subsequent operations can be performed offline.
If you want to use the native LibreTranslate project or deploy it in Docker, please visit https://github.com/LibreTranslate/LibreTranslate
Using Pre-compiled Windows Package
- If you cannot open https://raw.githubusercontent.com, you must set the proxy address in
PROXY=
in set.ini.
You can also download the packaged model from Baidu Netdisk, unzip it, and copy and overwrite the ".local" folder inside to the root directory of this software. Click to download from Baidu Netdisk
Click to download the Windows pre-compiled package, unzip it to an English directory without spaces, and double-click start.exe.
The first startup will automatically download the model. After the download is complete, the address and port of the current API service will be displayed, and it can be used. (You can also download the packaged model from Baidu Netdisk, unzip it, and copy and overwrite the ".local" folder inside to the root directory of this software.)
You can write your own program to request this API service to replace functions such as Baidu Translate, or fill it in some software that requires translation functions. For example, if you want to use it in video translation dubbing software, fill in the server address and port in the software menu - settings - OTT (default http://127.0.0.1:9911).
Source Code Deployment on Windows
First, download and install Python 3.9+ version from python.org, 3.10 is recommended. When installing, check carefully and select the "Add ... Path" checkbox to facilitate subsequent use.
Install the Git client on Windows. Click to download, select to download 64-bit Git for Windows Setup, double-click to install after downloading, and continue to the next step until completed.
Create an empty directory, such as creating a directory ott under the D drive, and then enter the directory
D:/ott
. Entercmd
in the folder address bar and press Enter, and entergit clone https://github.com/jianchang512/ott .
in the opened cmd black window and press Enter to execute.Create a virtual environment, and continue to enter the command
python -m venv venv
in the just cmd window and press Enter.
Please note: If it prompts "python is not an internal or external command, nor is it a runnable program", it means that the checkbox was not selected during installation in step 0. Double-click the downloaded Python installation package again, select "Modify", and then be sure to select "Add ... Path".
After reinstalling Python, you must close the opened cmd window, otherwise it may still prompt that the command is not found, then enter
D:/ott
, entercmd
in the address bar and press Enter, and then re-executepython -m venv venv
.
After the above command is executed successfully, continue to enter
.\venv\scripts\activate
and press Enter, and then executepip install -r requirements.txt --no-deps
. If it prompts "not found version xxx", please change the mirror source to pip official or Alibaba Cloud mirror.If you need to enable CUDA accelerated translation, then continue to execute
pip uninstall -y torch
pip install torch==2.1.2 --index-url https://download.pytorch.org/whl/cu121
Set the proxy in set.ini PROXY=proxy address, for example, if your proxy address is
http://127.0.0.1:10189
, then fill inPROXY=http://127.0.0.1:10189
Execute the command to start the service,
python start.py