---
title: 用 GPT-3.5 翻译整本英文书，输出中英双语电子书
date: 2023-03-03T09:05:59Z
modified: 2023-03-06T13:04:26Z
permalink: "https://www.appinn.com/bilingual-book-maker/"
type: post
status: publish
excerpt: ""
categories:
  - 在线应用
tags:
  - 在线应用
  - ChatGPT
  - twp
  - 翻译
  - 问ChatGPT
featured_image: "https://www.appinn.com/wp-content/uploads/2023/03/bilingual_book_maker.jpgo_.jpg"
author: 青小蛙
timestamp: 2023-03-06T13:04:26Z
---

**bilingual\_book\_maker** 是来自 [@yihong0618](https://twitter.com/yihong0618/status/1630948132564631552) 同学的一个 Python 脚本，它可以用 GPT-3.5 翻译整本英文书（.epub 格式），并输出为 .epub 格式的中英双语电子书。当然，这个脚本不光可以翻译英文书，也可以是其它语言。@Appinn

![](https://static2.appinn.com/images/202303/bilingual_book_maker.jpg)

## 项目地址

- [Github](https://github.com/yihong0618/bilingual_book_maker)

需要 [OpenAI API](https://platform.openai.com/account/api-keys)，超量需要付费使用。项目里带了几本原版英文书，位于 `/test_books` 下

### 使用

1. pip install -r requirements.txt
2. openapi token
3. 本地放了一个 animal\_farm.epub 给大家测试
4. 默认用了 ChatGPT 模型，用 `--model gpt3` 来使用 gpt3 模型
5. 加了 `--test` 命令如果大家没付费可以加上这个先看看效果（有 limit 稍微有些慢）


# 如果你想快速测一下
python3 make.py --book_name test_books/animal_farm.epub --openai_key ${openai_key} --no_limit --test
# or do it
python3 make.py --book_name test_books/animal_farm.epub --openai_key ${openai_key}
# or 用 gpt3 模型
export OPENAI_API_KEY=${your_api_key}
python3 make.py --book_name test_books/animal_farm.epub --model gpt3 --no_limit


---

这是青小蛙偶然看到的，[@CooperKai](https://twitter.com/King85432664/status/1631248166271217664) 同学基于这个脚本测试：

这本 [Antifragile](https://en.wikipedia.org/wiki/Antifragile_(book))，从3：20 => 6：30 翻译完毕，共计用时3小时10分，消耗 619619 tokens，Chatgpt 说这本书英文版18万字。

而基于目前 gpt-3.5-turbo 的定价，这本书一共需要 (619,619 / 1000) \* $0.002 = $1.24

不知道出版社和译者们看到这些后，有啥感想 😂

## Topics

**分类目录:** [在线应用](https://www.appinn.com/category/online-tools/?output_format=md)

**标签:** [ChatGPT](https://www.appinn.com/tag/chatgpt/?output_format=md), [twp](https://www.appinn.com/tag/twp/?output_format=md), [翻译](https://www.appinn.com/tag/%e7%bf%bb%e8%af%91/?output_format=md), [问ChatGPT](https://www.appinn.com/tag/%e9%97%aechatgpt/?output_format=md)