Local offline all-purpose translation program

I open sourced an all-purpose translation program on GitHub, github address: https://github.com/tianclll/Ace-Translate

Ace-Translate

A local offline translation program

Supports multiple translation scenarios

  • Chinese to English and English to Chinese
  • text translation
  • word translation
  • screenshot translation
  • video translation
  • Document translation, including TXT files, Excel, PPT, PDF, pictures and Word
  • Document image translation

Install

Recommended to use python3.8++paddlepaddle2.4.0torch2.0.1

1. Pull code

git clone https://github.com/tianclll/Ace-Translate.git
cd Ace-Translate

2.Installation

2.1 Install PaddlePaddle
  • GPU

    python3 -m pip install paddlepaddle-gpu==2.4.0 -i https://mirror.baidu.com/pypi/simple
    
  • CPU

    python3 -m pip install paddlepaddle==2.4.0 -i https://mirror.baidu.com/pypi/simple
    
2.2 Install dependencies
pip install -r requirements.txt
  • Windows requires additional downloads
    pip install transformers[sentencepiece]
    pip install clip
    
2.3 Download model file

Click here to download

After unzipping, place it in the project folder (Ace-Translate).

2.4 Install Pyaudio

Need to run voice translation before installation

  • Linux

    sudo apt-get install libasound2-dev
    wget https://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz
    tar -xvf pa_stable_v190700_20210406.tgz
    cd portaudio
    ./configure
    make
    sudo make install
    make clean
    sudo apt-get install python3-pyaudio 
    pip install pyaudio
    
  • Mac

    sudo brew install libasound2-dev
    wget https://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz
    tar -xvf pa_stable_v190700_20210406.tgz
    cd portaudio
    ./configure
    make
    sudo make install
    make clean
    pip install pyaudio
    
  • Windows

    pip install pipwin
    pipwin install pyaudio
    
2.5 Install ImageMagick

You need to run video translation before installing
the official website download address

3. Settings

Modify config.conffile:

  • Set shortcut keys
  • Set up the running device gpuorcpu

4. Run

Note: The first time the voice translation module needs to be connected to the Internet

python main.py

Show results

There are four functions: "Word Translation", "Screenshot Translation", "PDF Translation", and "Document Picture Translation". After the project is run, it will be mounted on the status bar. When you click "x", it will not exit but will be hidden. Click the status Click "Open" on the status bar and it will pop up. Click "Exit" on the status bar to actually exit the program. (Ubuntu18.04 and later have no status bar by default)

text translation

text translation

word translation

  • Select "Chinese to English" or "English to Chinese" and click Start
  • Then select the content you want to translate with your mouse and click copy
  • Press the set shortcut key to translate

word translation

screenshot translation

screenshot translation

Voice translation

Support audio files and voice recording

Voice translation

video translation

Support output srt subtitle files and videos

video translation video translation

Document translation

  • TXT

TXT file translation TXT file translation

  • PDF

PDF file translation PDF file translation

  • Excel

Excel file translation Excel file translation

  • Word

Word document translation Word document translation

Document image translation

Document image translation Document image translation

Guess you like

Origin blog.csdn.net/tianclll/article/details/133500843