stream-translator-gpt-webui
English | 繁體中文
stream-translator-gpt-webui This project is based on stream-translator-gpt, aiming to provide viewers with real-time subtitle translation using large language models while watching YouTube live streams.
It combines live streaming, chat room, and subtitle translation features on a single page, offering a better live streaming experience for viewers who don't understand other languages. Currently supports mutual translation between Japanese, English, and Chinese.
(The translation model in this image is gemma2-27b)
Preparation (Windows)
1.Install Python 3.10( (recommended)
2.Install CUDA12.1 (recommended)
3.Install CUDNN
4.Install Pytorch (must match CUDA version)
5.Install ffmpeg
6.Install yt-dlp(recommended to use PIP)
7.Install stream-translator-gpt
8.Install redis (recommended to download from GitHub)
9.Install dependencies:
pip install flask flask-socketio flask-limiter python-dotenv requests yt-dlp ffmpeg gevent
10.If you want to use Gemini API for translation, you need to create a Google API key. (15 free requests per minute)
11.If you want to use GPT API for translation, you need to create an OpenAI API key
12.If you want to use Local LLM for translation, you need to set up your own or use a method compatible with the OpenAI API. You mainly need to fill in the URL and API key of your self-hosted large model. (Currently tested with sakura 14b / gemma 27b / llama 3.1 8b)
Apply for a YouTube Data API key
13.Download this project as a ZIP file
*Note ffmpeg, redis, cuda, cudnn need to be written into the system's environment variable path. After closing the webpage, you need to manually close the CMD window in the background. If you encounter torch-related errors, you can try using this:
Copy pip3 install torch==2.2.2 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
The environment variable PATH needs to include the following. If you've installed them in other locations, modify the paths accordingly based on where you've installed them:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\lib
C:\Users\User\AppData\Local\Programs\Python\Python310\
C:\Users\User\AppData\Local\Programs\Python\Python310\Scripts\
C:\Program Files\Redis
C:\ffmpeg\bin
How to run
1.Unzip the ZIP file.
2.Open the .env file with Notepad and enter your translation API key and YouTube Data API key.
3.Right-click inside the folder and select "Open in Terminal" or "Open command window here".
4.Run the program by typing python app.py in the terminal.
5.If you want a one-click solution, go to the releases section and download the pre-packaged EXE file. Place it in the folder, and you can use it directly.