中文 | English
Make bilingual epub books Using AI translate
- ChatGPT or OpenAI token
- prepared epub books
- Environment with internet access or proxy
- python3.8+
- pip install -r requirements.txt
- OpenAI API key. If you have multiple keys, separate them by commas (xxx,xxx,xxx) to reduce errors caused by API call limits.
- A sample book, test_books/animal_farm.epub, is provided for testing purposes.
- The default underlying model is GPT-3.5-turbo ,which is used by ChatGPT currently. Use
--model gpt3
to change the underlying model toGPT3
- Use --test command to preview the result if you haven't paid for the service. Note that there is a limit and it may take some time.
- Set the target language like
--language "Simplified Chinese"
. Support"Japanese" / "Traditional Chinese" / "German" / "French" / "Korean"
. Default target language is"Simplified Chinese"
. Support language list please see the LANGUAGES at utils.py. - Use the --proxy parameter to enable users in mainland China to use a proxy when testing locally. Enter a string such as http://127.0.0.1:7890.
- Use the --resume command to manually resume the process after an interruption.
- If you want to change api_base like using Cloudflare Workers Use --api_base ${url} to support it. **Note: the api url you input should be `https://xxxx/v1', and quotation marks are required. **
e.g.
# Test quickly
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --no_limit --test --language "Simplified Chinese"
# or do it
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --language "Simplified Chinese"
# or use the GPT-3 model
export OPENAI_API_KEY=${your_api_key}
python3 make_book.py --book_name test_books/animal_farm.epub --model gpt3 --no_limit --language "Simplified Chinese"
More understandable example
python3 make_book.py --book_name 'animal_farm.epub' --openai_key sk-XXXXX --api_base 'https://xxxxx/v1'
# or
python make_book.py --book_name 'animal_farm.epub' --openai_key sk-XXXXX --api_base 'https://xxxxx/v1'
- here is a limit. If you want to speed up the process, consider paying for the service or use multiple OpenAI tokens
- PR welcome
- The DeepL model will be updated later.
- Any issues or PRs are welcome.
- TODOs in the issue can also be selected.
- Please run black make_book.py before submitting the code.
Thank you, that's enough.