Git Product home page Git Product logo

bilingual_book_maker's Introduction

中文 | English

bilingual_book_maker

The bilingual_book_maker is an AI translation tool that uses ChatGPT to assist users in creating multi-language versions of epub files and books. This tool is exclusively designed for translating epub books that have entered the public domain and is not intended for copyrighted works. Prior to usage, please review the project's disclaimer.

image

Preparation

  1. ChatGPT or OpenAI token
  2. prepared epub books
  3. Environment with internet access or proxy
  4. python3.8+

Use

  1. pip install -r requirements.txt
  2. OpenAI API key. If you have multiple keys, separate them by commas (xxx,xxx,xxx) to reduce errors caused by API call limits.
  3. A sample book, test_books/animal_farm.epub, is provided for testing purposes.
  4. The default underlying model is GPT-3.5-turbo ,which is used by ChatGPT currently. Use --model gpt3 to change the underlying model to GPT3
  5. 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.
  6. 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.
  7. 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.
  8. Use the --resume command to manually resume the process after an interruption.
  9. 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. **
  10. Once the translation is complete, a bilingual book named ${book_name}_bilingual.epub will be generated.
  11. If there are any errors or you wish to interrupt the translation using CTRL+C and do not want to continue further, a book named ${book_name}_bilingual_temp.epub will be generated. You can simply rename it to the desired name.

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'

Notes

  1. here is a limit. If you want to speed up the process, consider paying for the service or use multiple OpenAI tokens
  2. PR welcome
  3. The DeepL model will be updated later.

Thanks

Contribution

  • Any issues or PRs are welcome.
  • TODOs in the issue can also be selected.
  • Please run black make_book.py before submitting the code.

Appreciation

Thank you, that's enough.

image

bilingual_book_maker's People

Contributors

yihong0618 avatar jeffery9 avatar brikarl avatar inzamz avatar danparizher avatar shaonianche avatar typebrook avatar eltociear avatar gnosis23 avatar kj-huang avatar tongzhao9417 avatar miblue119 avatar xyb avatar liyuankui avatar codingcao avatar guaguaguaxia avatar lantianyou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.