Skip to content

Latest commit

 

History

334 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文 | English litellm

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/txt/md/srt/pdf files and books. This tool is exclusively designed for translating epub and other public domain works and is not intended for copyrighted works. Before using this tool, please review the project's disclaimer.

image

Supported models

Built-in routes include OpenAI presets and arbitrary OpenAI-compatible model IDs, current Claude choices, Gemini, Qwen-MT, Groq, xAI, OrcaRouter, DeepL, Google, Caiyun, and Tencent TranSmart. The exact --model choices come from the installed version, so use python3 make_book.py --help. Unlisted gateways and native-provider model IDs can be configured with --provider; see Models and languages.

Preparation

  1. ChatGPT or OpenAI token 1
  2. epub/txt/md/pdf books
  3. Environment with internet access or proxy
  4. Python 3.10+

Quick Start

A sample book, test_books/animal_farm.epub, is provided for testing purposes.

pip install -r requirements.txt
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --test
OR
pip install -U bbook_maker
bbook_maker --book_name test_books/animal_farm.epub --openai_key ${openai_key} --test

Translate Service

  • Use --openai_key option to specify OpenAI API key. If you have multiple keys, separate them by commas (xxx,xxx,xxx) to reduce errors caused by API call limits. Or, just set environment variable BBM_OPENAI_API_KEY instead.
  • 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 gpt4 to change the underlying model to GPT4. You can also use GPT4omini.
  • Important to note that gpt-4 is significantly more expensive than gpt-4-turbo, but to avoid bumping into rate limits, we automatically balance queries across gpt-4-1106-preview, gpt-4, gpt-4-32k, gpt-4-0613,gpt-4-32k-0613.
  • If you want to use a specific model alias with OpenAI (eg gpt-4-1106-preview or gpt-3.5-turbo-0125), you can use --model openai --model_list gpt-4-1106-preview,gpt-3.5-turbo-0125. --model_list takes a comma-separated list of model aliases.
  • If using chatgptapi, you can add --use_context to add a context paragraph to each passage sent to the model for translation (see below).
  • DeepL Support DeepL model DeepL Translator need pay to get the token

    python3 make_book.py --book_name test_books/animal_farm.epub --model deepl --deepl_key ${deepl_key}
    
  • DeepL free

    python3 make_book.py --book_name test_books/animal_farm.epub --model deeplfree
  • Claude

    Use Claude model to translate

    python3 make_book.py --book_name test_books/animal_farm.epub --model claude --claude_key ${claude_key}
  • Google Translate

    python3 make_book.py --book_name test_books/animal_farm.epub --model google
  • Caiyun Translate

    python3 make_book.py --book_name test_books/animal_farm.epub --model caiyun --caiyun_key ${caiyun_key}
  • Gemini

    Support Google Gemini model, use --model gemini for Gemini Flash or --model geminipro for Gemini Pro. If you want to use a specific model alias with Gemini (eg gemini-2.5-flash or gemini-2.0-flash), you can use --model gemini --model_list gemini-2.5-flash,gemini-2.0-flash. --model_list takes a comma-separated list of model aliases.

    python3 make_book.py --book_name test_books/animal_farm.epub --model gemini --gemini_key ${gemini_key}
  • Qwen

    Support Alibaba Cloud Qwen-MT specialized translation model. Supports 92 languages with features like terminology intervention and translation memory. Use --model qwen-mt-turbo for faster/cheaper translation, or --model qwen-mt-plus for higher quality.

    Use source_lang to specify the source language explicitly, or leave it empty for auto-detection.

    python3 make_book.py --book_name test_books/animal_farm.epub --qwen_key ${qwen_key} --model qwen-mt-turbo --language "Simplified Chinese"
    python3 make_book.py --book_name test_books/animal_farm.epub --qwen_key ${qwen_key} --model qwen-mt-plus --language "Japanese" --source_lang "English"
  • Tencent TranSmart

    python3 make_book.py --book_name test_books/animal_farm.epub --model tencentransmart
  • xAI

    python3 make_book.py --book_name test_books/animal_farm.epub --model xai --xai_key ${xai_key}
  • OrcaRouter

    Support OrcaRouter gateway, defaulting to the orcarouter/auto smart-routing model. It also runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes.

    python3 make_book.py --book_name test_books/animal_farm.epub --model orcarouter --orcarouter_key ${orcarouter_key}
  • Ollama

    Support Ollama self-host models, If ollama server is not running on localhost, use --api_base http://x.x.x.x:port/v1 to point to the ollama server address

    python3 make_book.py --book_name test_books/animal_farm.epub --ollama_model ${ollama_model_name}
  • groq

    GroqCloud currently supports models: you can find from Supported Models

    python3 make_book.py --book_name test_books/animal_farm.epub --groq_key [your_key] --model groq --model_list llama3-8b-8192
  • Custom API Provider

    If the built-in models don't cover your needs, you can define custom providers via a JSON config file. This lets you use any OpenAI-compatible API (DeepSeek, SiliconFlow, local proxies, etc.) without modifying source code.

    Create bbm_providers.json in the current directory (or ~/.bbm/providers.json for global config):

    {
      "providers": {
        "deepseek": {
          "api_style": "openai",
          "base_url": "https://api.deepseek.com/v1",
          "default_models": ["deepseek-chat", "deepseek-reasoner"],
          "env_key": "BBM_DEEPSEEK_API_KEY"
        },
        "siliconflow": {
          "api_style": "openai",
          "base_url": "https://api.siliconflow.cn/v1",
          "default_models": ["Qwen/Qwen2.5-72B-Instruct"],
          "env_key": "BBM_SILICONFLOW_API_KEY"
        }
      }
    }

    Config fields:

    Field Required Description
    api_style Yes Translator interface style. Supported: openai, claude, gemini, qwen
    base_url No API endpoint URL. Falls back to the api_style's default
    default_models No Default model list. Required if --model_list is not provided
    env_key No Environment variable name for API key. Required if --api_key is not provided

    Priority: project-level ./bbm_providers.json overrides global ~/.bbm/providers.json.

    --provider and --model are mutually exclusive.

    python3 make_book.py --provider deepseek --api_key sk-xxx --book_name test_books/animal_farm.epub
    
    export BBM_DEEPSEEK_API_KEY=sk-xxx
    python3 make_book.py --provider deepseek --book_name test_books/animal_farm.epub
    
    python3 make_book.py --provider deepseek --api_key sk-xxx --model_list deepseek-reasoner --book_name test_books/animal_farm.epub

Use

  • Once the translation is complete, a bilingual book named ${book_name}_bilingual.epub would be generated for EPUB inputs; for TXT/MD/SRT inputs a bilingual text (or subtitle) file named ${book_name}_bilingual.txt (or _bilingual.srt) will be generated. For PDF inputs the tool will produce a bilingual .txt fallback and will also attempt to create ${book_name}_bilingual.epub — if EPUB creation fails, the TXT fallback remains so you do not need to retranslate.
  • If there are any errors or you wish to interrupt the translation by pressing CTRL+C, a temporary bilingual file (for example {book_name}_bilingual_temp.epub or {book_name}_bilingual_temp.txt) would be generated. You can simply rename it to any desired name.

Params

  • --model:

    Select the translation model. Default: chatgptapi. Available values and their behavior:

    Model Key Source Notes
    chatgptapi --openai_key / BBM_OPENAI_API_KEY GPT-3.5-turbo. Auto-detects available models from API
    gpt4 --openai_key / BBM_OPENAI_API_KEY GPT-4 family. Auto-balances across available GPT-4 variants
    gpt4omini --openai_key / BBM_OPENAI_API_KEY GPT-4o-mini
    gpt4o --openai_key / BBM_OPENAI_API_KEY GPT-4o
    gpt5mini --openai_key / BBM_OPENAI_API_KEY GPT-5-mini
    o1preview --openai_key / BBM_OPENAI_API_KEY o1-preview
    o1 --openai_key / BBM_OPENAI_API_KEY o1
    o1mini --openai_key / BBM_OPENAI_API_KEY o1-mini
    o3mini --openai_key / BBM_OPENAI_API_KEY o3-mini
    openai --openai_key / BBM_OPENAI_API_KEY Requires --model_list. Use any OpenAI-compatible model
    claude and listed claude-* IDs --claude_key / BBM_CLAUDE_API_KEY Exact built-in choices shown by --help; arbitrary unlisted IDs require --provider or the openai route
    gemini --gemini_key / BBM_GOOGLE_GEMINI_KEY Gemini Flash. Supports --model_list
    geminipro --gemini_key / BBM_GOOGLE_GEMINI_KEY Gemini Pro
    groq --groq_key / BBM_GROQ_API_KEY Requires --model_list
    xai --xai_key / BBM_XAI_API_KEY Grok
    orcarouter --orcarouter_key / BBM_ORCAROUTER_API_KEY OrcaRouter smart routing; defaults to orcarouter/auto
    qwen-mt-turbo --qwen_key / BBM_QWEN_API_KEY Qwen fast translation model
    qwen-mt-plus --qwen_key / BBM_QWEN_API_KEY Qwen high-quality translation model
    google N/A Free. No API key needed
    caiyun --caiyun_key / BBM_CAIYUN_API_KEY Caiyun
    deepl --deepl_key / BBM_DEEPL_API_KEY DeepL (paid)
    deeplfree N/A DeepL Free
    tencentransmart N/A Tencent TranSmart. Free
    customapi --custom_api / BBM_CUSTOM_API Custom translation API

    For any OpenAI-compatible API not listed above, use --provider instead (see Custom API Provider section).

  • --test:

    Use --test option to preview the result if you haven't paid for the service. Note that there is a limit and it may take some time.

  • --language:

    Set the target language like --language "Simplified Chinese". Default target language is "Simplified Chinese". Read available languages by helper message: python make_book.py --help

  • --proxy:

    Use --proxy option to specify proxy server for internet access. Enter a string such as http://127.0.0.1:7890.

  • --resume:

    Use --resume option to manually resume the process after an interruption.

    python3 make_book.py --book_name test_books/animal_farm.epub --model google --resume
  • --translate-tags:

    epub is made of html files. By default, we only translate contents in <p>. Use --translate-tags to specify tags need for translation. Use comma to separate multiple tags. For example: --translate-tags h1,h2,h3,p,div

  • --plan-classify {none,most,model,agent} (epub only):

    Plan mode: instead of selecting tags, every text node in the book is either assigned to a translation unit or skipped for an explicit, reported reason (hidden content, page-list navs, symbols, links, ...). This is the right choice for books whose text does not live in <p> — e.g. poetry rendered as per-line <div>s or <blockquote>s, which the default would silently skip. Runs of short verse lines are batched into stanza windows (up to --poetry-group-size lines, default 8) and translated in one request so the model sees neighboring lines for context.

    The partition is deliberately greedy: it keeps everything it cannot rule out structurally, because guessing from shape used to drop real content (verse numbers, one-word dialogue, drop caps) to save only 0–6% of characters. Deciding what is not worth translating is the classification entry you pick here:

    • none (default): no plan — translate the --translate-tags selection as usual.
    • most: translate the whole partition, no classification.
    • model: an LLM rules on the uncertain signatures first (headings, the prose spine and poetry groups are never asked about), then the run continues. Use --plan-classify-model X to pick a different model for it — naming one implies this mode, and a failure then aborts instead of falling back.
    • agent: makes no API call. Writes the plan, prints a block of instructions to paste into a coding-agent session (Claude Code, Codex, ...), and stops before translating. Edit the actions, then rerun the same command to translate.

    In plan mode --translate-tags is ignored — the plan partitions the whole book.

    • --plan-dry-run: print the per-signature coverage table, write <book>_plan.json, and exit. No API key or credits needed. Honors --only_filelist / --exclude_filelist.
    • <book>_plan.json: edit a signature's "action" to "skip" to exclude it from the real run; the file is never overwritten once it exists (delete it to regenerate). Each row carries up to 5 real samples so you can judge without opening the epub.
    • --plan-min-coverage (default 0.5): plan mode aborts if the plan covers less than this fraction of the book's text, instead of silently translating a fraction of it.
    # inspect what would be translated (free, no key needed)
    python3 make_book.py --book_name my_book.epub --plan-dry-run
    # translate the whole partition
    python3 make_book.py --book_name my_book.epub --openai_key ${key} --plan-classify most
    # let a model triage the apparatus first
    python3 make_book.py --book_name my_book.epub --openai_key ${key} --plan-classify model
    # or hand the triage to a coding agent (stops, prints instructions, then rerun)
    python3 make_book.py --book_name my_book.epub --openai_key ${key} --plan-classify agent
  • --exclude-translate-tags:

    Use --exclude-translate-tags to exclude content within specified HTML tags from translation. This is useful for preserving code blocks, preformatted text, or other special content. Use comma to separate multiple tags. Default: sup,code. For example: --exclude-translate-tags code,pre

    Tip: Use --exclude-translate-tags "" to translate all content including code blocks (overrides the default exclusion).

  • --book_from:

    Use --book_from option to specify e-reader type (Now only kobo is available), and use --device_path to specify the mounting point.

  • --api_base:

    If you want to change api_base like using Cloudflare Workers, use --api_base <URL> to support it. Note: the api url should be 'https://xxxx/v1'. Quotation marks are required.

  • --allow_navigable_strings:

    If you want to translate strings in an e-book that aren't labeled with any tags, you can use the --allow_navigable_strings parameter. This will add the strings to the translation queue. Note that it's best to look for e-books that are more standardized if possible.

  • --prompt:

    To tweak the prompt, use the --prompt parameter. Valid placeholders for the user role template include {text} and {language}. It supports a few ways to configure the prompt:

    • If you don't need to set the system role content, you can simply set it up like this: --prompt "Translate {text} to {language}." or --prompt prompt_template_sample.txt (example of a text file can be found at ./prompt_template_sample.txt).

    • If you need to set the system role content, you can use the following format: --prompt '{"user":"Translate {text} to {language}", "system": "You are a professional translator."}' or --prompt prompt_template_sample.json (example of a JSON file can be found at ./prompt_template_sample.json).

    • You can now use PromptDown format (.md files) for more structured prompts: --prompt prompt_md.prompt.md. PromptDown supports both traditional system messages and developer messages (used by newer AI models). Example:

      # Translation Prompt
      
      ## Developer Message
      You are a professional translator who specializes in accurate translations.
      
      ## Conversation
      
      | Role | Content                                                        |
      | ---- | -------------------------------------------------------------- |
      | User | Please translate the following text into {language}:\n\n{text} |
    • You can also set the user and system role prompt by setting environment variables: BBM_CHATGPTAPI_USER_MSG_TEMPLATE and BBM_CHATGPTAPI_SYS_MSG.

  • --batch_size:

    Use the --batch_size parameter to specify the number of lines for batch translation (default is 10, currently only effective for txt files).

  • --accumulated_num:

    Wait for how many tokens have been accumulated before starting the translation. gpt3.5 limits the total_token to 4090. For example, if you use --accumulated_num 1600, maybe openai will output 2200 tokens and maybe 200 tokens for other messages in the system messages user messages, 1600+2200+200=4000, So you are close to reaching the limit. You have to choose your own value, there is no way to know if the limit is reached before sending

  • --use_context:

    prompts the model to create a three-paragraph summary. If it's the beginning of the translation, it will summarize the entire passage sent (the size depending on --accumulated_num). For subsequent passages, it will amend the summary to include details from the most recent passage, creating a running one-paragraph context payload of the important details of the entire translated work. This improves consistency of flow and tone throughout the translation. This option is available for all ChatGPT-compatible models and Gemini models.

  • --context_paragraph_limit:

    Use --context_paragraph_limit to set a limit on the number of context paragraphs when using the --use_context option.

  • --parallel-workers:

    Use --parallel-workers to process EPUB chapters or Markdown batches/sections in parallel. Values greater than 1 spin up multiple workers (recommended: 2-4) and automatically fall back to sequential mode when there is only one unit of work. Other input loaders currently accept this shared CLI option but do not parallelize their work.

  • --temperature:

    Use --temperature to set the temperature parameter for chatgptapi/gpt4/claude models. For example: --temperature 0.7.

  • --block_size:

    Use --block_size to merge multiple paragraphs into one block. This may increase accuracy and speed up the process. For example: --block_size 5.

  • --single_translate:

    Use --single_translate to output only the translated book without creating a bilingual version.

  • --translation_style:

    Apply custom CSS to translated EPUB text, for example --translation_style "color: #808080; font-style: italic;".

  • --translation_color:

    Shorthand for setting only the translated EPUB text color, for example --translation_color "#1e90ff". If --translation_style is also present, the full style takes precedence.

  • --pdf_layout {none,top-bottom,side-by-side,all}:

    Select additional bilingual PDF outputs for PDF inputs. The default none creates no extra PDF; all attempts both top-bottom and side-by-side layouts. The bilingual TXT and EPUB outputs are unaffected.

  • --sentence_mode:

    Translate EPUB text sentence by sentence instead of translating each paragraph as one unit. It is incompatible with EPUB plan mode.

  • --batch / --batch-use:

    Two-stage EPUB translation through the ChatGPT Batch API. First run with --batch to submit the batch, then rerun with --batch-use to wait for and consume its results. These flags are incompatible with plan mode.

  • --interval:

    Gemini request interval in seconds (default 0.01). It has no effect on other model routes.

  • --quiet:

    Suppress EPUB progress bars and per-paragraph source/translation echoes while retaining reports and errors. Recommended for log files and non-interactive agent runs.

  • --retranslate "$translated_filepath" "file_name_in_epub" "start_str" "end_str":

    Retranslate from start_str to end_str's tag:

    python3 "make_book.py" --book_name "test_books/animal_farm.epub" --retranslate 'test_books/animal_farm_bilingual.epub' 'index_split_002.html' 'in spite of the present book shortage which' 'This kind of thing is not a good symptom. Obviously'

    To retranslate only the tag containing start_str, pass an empty fourth argument:

    python3 "make_book.py" --book_name "test_books/animal_farm.epub" --retranslate 'test_books/animal_farm_bilingual.epub' 'index_split_002.html' 'in spite of the present book shortage which' ''
  • --extra_body:

    Pass additional JSON parameters on ChatGPT/OpenAI-derived request paths, including OpenAI-style custom providers and xAI. Claude, Gemini, Qwen, Groq, and other translators currently ignore this option. Provide a JSON string with the desired parameters.

    python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --extra_body '{"chat_template_kwargs": {"enable_thinking": false}}'
  • --provider:

    Use a custom provider defined in bbm_providers.json. Mutually exclusive with --model. See the "Custom API Provider" section above.

  • --api_key:

    API key for custom providers (used with --provider). Can also be set via the env_key field in the provider config.

Examples

Note if use pip install bbook_maker all commands can change to bbook_maker args

# Test quickly
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key}  --test --language zh-hans

# Test quickly for src
python3 make_book.py --book_name test_books/Lex_Fridman_episode_322.srt --openai_key ${openai_key}  --test

# Or translate the whole book
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --language zh-hans

# Or translate the whole book using Gemini flash
python3 make_book.py --book_name test_books/animal_farm.epub --gemini_key ${gemini_key} --model gemini

# Translate an EPUB with parallel chapter processing
python3 make_book.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --parallel-workers 4

# Use a specific list of Gemini model aliases
python3 make_book.py --book_name test_books/animal_farm.epub --gemini_key ${gemini_key} --model gemini --model_list gemini-2.5-flash,gemini-2.0-flash

# Set env OPENAI_API_KEY to ignore option --openai_key
export OPENAI_API_KEY=${your_api_key}

# Use the GPT-4 model with context to Japanese
python3 make_book.py --book_name test_books/animal_farm.epub --model gpt4 --use_context --language ja

# Use a specific OpenAI model alias
python3 make_book.py --book_name test_books/animal_farm.epub --model openai --model_list gpt-4-1106-preview --openai_key ${openai_key}

**Note** you can use other `openai like` model in this way
python3 make_book.py --book_name test_books/animal_farm.epub --model openai --model_list yi-34b-chat-0205 --openai_key ${openai_key} --api_base "https://api.lingyiwanwu.com/v1"

# Use a specific list of OpenAI model aliases
python3 make_book.py --book_name test_books/animal_farm.epub --model openai --model_list gpt-4-1106-preview,gpt-4-0125-preview,gpt-3.5-turbo-0125 --openai_key ${openai_key}

# Use the DeepL model with Japanese
python3 make_book.py --book_name test_books/animal_farm.epub --model deepl --deepl_key ${deepl_key} --language ja

# Use the Claude model with Japanese
python3 make_book.py --book_name test_books/animal_farm.epub --model claude --claude_key ${claude_key} --language ja

# Use the CustomAPI model with Japanese
python3 make_book.py --book_name test_books/animal_farm.epub --model customapi --custom_api ${custom_api} --language ja

# Use a custom provider (e.g. DeepSeek)
python3 make_book.py --book_name test_books/animal_farm.epub --provider deepseek --api_key sk-xxx --language ja

# Translate contents in <div> and <p>
python3 make_book.py --book_name test_books/animal_farm.epub --translate-tags div,p

# Plan mode: auto-discover translatable content (poetry, blockquotes, table cells,
# ...) and batch verse lines in stanza windows; preview the plan with --plan-dry-run
python3 make_book.py --book_name test_books/animal_farm.epub --plan-dry-run
python3 make_book.py --book_name test_books/animal_farm.epub --plan-classify most

# Tweaking the prompt
python3 make_book.py --book_name test_books/animal_farm.epub --prompt prompt_template_sample.txt
# or
python3 make_book.py --book_name test_books/animal_farm.epub --prompt prompt_template_sample.json
# or
python3 make_book.py --book_name test_books/animal_farm.epub --prompt "Please translate \`{text}\` to {language}"

# Translate books download from Rakuten Kobo on kobo e-reader
python3 make_book.py --book_from kobo --device_path /tmp/kobo

# translate txt file
python3 make_book.py --book_name test_books/the_little_prince.txt --test --language zh-hans
# aggregated translation txt file
python3 make_book.py --book_name test_books/the_little_prince.txt --test --batch_size 20

# Using Caiyun model to translate
# (the api currently only support: simplified chinese <-> english, simplified chinese <-> japanese)
# the official Caiyun has provided a test token (3975l6lr5pcbvidl6jl2)
# you can apply your own token by following this tutorial(https://bobtranslate.com/service/translate/caiyun.html)
python3 make_book.py --model caiyun --caiyun_key 3975l6lr5pcbvidl6jl2 --book_name test_books/animal_farm.epub


# Set env BBM_CAIYUN_API_KEY to ignore option --openai_key
export BBM_CAIYUN_API_KEY=${your_api_key}

More understandable example

python3 make_book.py --book_name 'animal_farm.epub' --openai_key sk-XXXXX --api_base 'https://xxxxx/v1'

# Or python3 is not in your PATH
python make_book.py --book_name 'animal_farm.epub' --openai_key sk-XXXXX --api_base 'https://xxxxx/v1'

Microsoft Azure Endpoints

python3 make_book.py --book_name 'animal_farm.epub' --openai_key XXXXX --api_base 'https://example-endpoint.openai.azure.com' --deployment_id 'deployment-name'

# Or python3 is not in your PATH
python make_book.py --book_name 'animal_farm.epub' --openai_key XXXXX --api_base 'https://example-endpoint.openai.azure.com' --deployment_id 'deployment-name'

Docker

You can use Docker if you don't want to deal with setting up the environment.

# Build image
docker build --tag bilingual_book_maker .

# Run container
# "$folder_path" represents the folder where your book file locates. Also, it is where the processed file will be stored.

# Windows PowerShell
$folder_path=your_folder_path # $folder_path="C:\Users\user\mybook\"
$book_name=your_book_name # $book_name="animal_farm.epub"
$openai_key=your_api_key # $openai_key="sk-xxx"
$language=your_language # see utils.py

docker run --rm --name bilingual_book_maker --mount type=bind,source=$folder_path,target='/app/test_books' bilingual_book_maker --book_name "/app/test_books/$book_name" --openai_key $openai_key --language $language

# Linux
export folder_path=${your_folder_path}
export book_name=${your_book_name}
export openai_key=${your_api_key}
export language=${your_language}

docker run --rm --name bilingual_book_maker --mount type=bind,source=${folder_path},target='/app/test_books' bilingual_book_maker --book_name "/app/test_books/${book_name}" --openai_key ${openai_key} --language "${language}"

For example:

# Linux
docker run --rm --name bilingual_book_maker --mount type=bind,source=/home/user/my_books,target='/app/test_books' bilingual_book_maker --book_name /app/test_books/animal_farm.epub --openai_key sk-XXX --test --test_num 1 --language zh-hant

Notes

  1. API token from free trial has limit. If you want to speed up the process, consider paying for the service or use multiple OpenAI tokens
  2. PR is welcome

Thanks

Contribution

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

Others better

Appreciation

Thank you, that's enough.

image

Footnotes

  1. https://platform.openai.com/account/api-keys

  2. https://github.com/psf/black

About

Make bilingual epub books Using AI translate

Resources

Stars

9.6k stars

Watchers

53 watching

Forks

Releases

Packages

Used by

Contributors

Languages