Offline Text Translate (OTT)
Supports multilingual offline text translation and provides API interfaces.
This project is a re-packaging based on the open-source project LibreTranslate. The purpose is to provide an easy-to-deploy translation API service on a local machine, without needing Docker. It also provides pre-compiled Windows exe packages, eliminating the need for deployment; simply double-click to use, making it convenient for beginners.
The first startup requires downloading the model; subsequent runs can operate offline.
If you want to use the native LibreTranslate project or deploy it in Docker, please visit https://github.com/LibreTranslate/LibreTranslate
Windows Pre-compiled Package Usage
- If you cannot access https://raw.githubusercontent.com, you must set the proxy address in set.ini using
PROXY=
.
You can also download the pre-packaged model from Baidu Netdisk, unzip it, and copy and paste the ".local" folder 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 model will be downloaded automatically after the first startup. 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 pre-packaged model from Baidu Netdisk, unzip it, and copy and paste the ".local" folder to the root directory of this software)
You can write your own program to request this API service, replacing Baidu Translate and other functions, or fill it into some software that requires translation functions. For example, if you want to use it in video translation and 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 python3.9+ from python.org, version 3.10 is recommended. During installation, carefully check and select the "Add ... Path" checkbox for convenient subsequent use.
Install the git client on Windows, click to download, select 64-bit Git for Windows Setup, and double-click to install, continuing through the steps until complete.
Create an empty directory, for example, create a directory ott on the D drive, then enter the directory
D:/ott
, entercmd
in the folder address bar and press Enter. In the opened cmd black window, entergit clone https://github.com/jianchang512/ott .
and press Enter to execute.Create a virtual environment. In the same cmd window, continue to enter the command
python -m venv venv
and press Enter.
Note: If the prompt "python is not an internal or external command, nor is it a runnable program" appears, it means that the checkbox was not selected in step 0. Double-click the downloaded Python installation package again, select "Modify", and then make sure to select "Add ... Path". After reinstalling python, **you must close the opened cmd window**, otherwise the command may still be reported as not found. Then enter `D:/ott`, enter `cmd` in the address bar and press Enter, and then re-execute `python -m venv venv`
After the above command is executed successfully, continue to enter
.\venv\scripts\activate
and press Enter, then executepip install -r requirements.txt --no-deps
. If the prompt “not found version xxx” appears, please change the mirror source to the official pip or Alibaba Cloud mirror.If you need to enable CUDA acceleration for translation, 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 ishttp://127.0.0.1:10189
, then fill inPROXY=http://127.0.0.1:10189
Execute the startup service command:
python start.py