一款由 LLM 提供支持的多功能 AI 翻译工具。
English | 中文
All the code and documentation are entirely generated by OpenAI's GPT-4 ModelOpenAI Translator is an AI-powered translation tool designed to translate English PDF books to Chinese. The tool leverages large language models (LLMs) like ChatGLM and OpenAI's GPT-3 and GPT-3.5 Turbo for translation. It's built in Python and has a flexible, modular, and object-oriented design.
In the current landscape, there's a lack of non-commercial yet efficient PDF translation tools. Many users have PDF documents with sensitive data that they prefer not to upload to public commercial service websites due to privacy concerns. This project was developed to address this gap, providing a solution for users who need to translate their PDFs while maintaining data privacy.
The OpenAI Translator is still in its early stages of development, and I'm actively working on adding more features and improving its performance. We appreciate any feedback or contributions!
"The Old Man and the Sea"1.Clone the repository git clone [email protected]:DjangoPeng/openai-translator.git.
2.The OpenAI-Translator requires Python 3.6 or later. Install the dependencies with pip install -r requirements.txt.
3.Set up your OpenAI API key($OPENAI_API_KEY) or ChatGLM Model URL($GLM_MODEL_URL). You can either add it to your environment variables or specify it in the config.yaml file.
You can use OpenAI-Translator either by specifying a configuration file or by providing command-line arguments.
Adapt config.yaml file with your settings:
OpenAIModel:
model: "gpt-3.5-turbo"
api_key: "your_openai_api_key"
GLMModel:
model_url: "your_chatglm_model_url"
timeout: 300
common:
book: "test/test.pdf"
file_format: "markdown"Then run the tool:
python ai_translator/main.pyYou can also specify the settings directly on the command line. Here's an example of how to use the OpenAI model:
# Set your api_key as an env variable
export OPENAI_API_KEY="sk-xxx"
python ai_translator/main.py --model_type OpenAIModel --api_key $OPENAI_API_KEY --book your_book.pdf And an example of how to use the GLM model:
# Set your GLM Model URL as an env variable
export GLM_MODEL_URL="http://xxx:xx"
python ai_translator/main.py --model_type GLMModel --glm_model_url $GLM_MODEL_URL --book your_book.pdf This project is licensed under the GPL-3.0 License. See the LICENSE file for details.
暂无开放 Issues,或尚未同步最近议题。