fix: use test instead of string

This commit is contained in:
yihong0618 2023-03-02 19:26:02 +08:00
parent cd8ac84fa8
commit 0442b12094
5 changed files with 5 additions and 5 deletions

View File

@ -23,12 +23,12 @@ Make bilingual epub books Using AI translate
e.g.
```shell
# 如果你想快速测一下
python3 make.py - --book_name animal_farm.epub --openai_key ${openai_key} --no_limit --test
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 animal_farm.epub --openai_key ${openai_key}
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 animal_farm.epub --model gpt3 --no_limit
python3 make.py --book_name test_books/animal_farm.epub --model gpt3 --no_limit
```
## 注意

View File

@ -139,11 +139,11 @@ class BEPUB:
is_test_done = IS_TEST and index > 20
for p in p_list:
if not is_test_done:
if p.string and not p.string.isdigit():
if p.text and not p.text.isdigit():
new_p = copy(p)
# TODO banch of p to translate then combine
# PR welcome here
new_p.string = self.translate_model.translate(p.string)
new_p.string = self.translate_model.translate(p.text)
p.insert_after(new_p)
index += 1
i.content = soup.prettify().encode()

Binary file not shown.

BIN
test_books/lemo.epub Normal file

Binary file not shown.