Spaces:
Paused
Paused
Upload bilingual_book_maker/.github/workflows/make_test_ebook.yaml with huggingface_hub
Browse files
bilingual_book_maker/.github/workflows/make_test_ebook.yaml
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: CI
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [ main ]
|
| 6 |
+
pull_request:
|
| 7 |
+
branches: [ main ]
|
| 8 |
+
workflow_dispatch:
|
| 9 |
+
|
| 10 |
+
env:
|
| 11 |
+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
| 12 |
+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
| 13 |
+
BBM_CAIYUN_API_KEY: ${{ secrets.BBM_CAIYUN_API_KEY }}
|
| 14 |
+
|
| 15 |
+
jobs:
|
| 16 |
+
typos-check:
|
| 17 |
+
name: Spell Check with Typos
|
| 18 |
+
runs-on: ubuntu-latest
|
| 19 |
+
steps:
|
| 20 |
+
- name: Checkout Actions Repository
|
| 21 |
+
uses: actions/checkout@v3
|
| 22 |
+
- name: Check spelling with custom config file
|
| 23 |
+
uses: crate-ci/typos@v1.16.6
|
| 24 |
+
with:
|
| 25 |
+
config: ./typos.toml
|
| 26 |
+
testing:
|
| 27 |
+
runs-on: ubuntu-latest
|
| 28 |
+
steps:
|
| 29 |
+
- uses: actions/checkout@v3
|
| 30 |
+
- name: install python 3.9
|
| 31 |
+
uses: actions/setup-python@v4
|
| 32 |
+
with:
|
| 33 |
+
python-version: '3.9'
|
| 34 |
+
cache: 'pip' # caching pip dependencies
|
| 35 |
+
- name: Check formatting (black)
|
| 36 |
+
run: |
|
| 37 |
+
pip install black
|
| 38 |
+
black . --check
|
| 39 |
+
- name: install python requirements
|
| 40 |
+
run: pip install -r requirements.txt
|
| 41 |
+
|
| 42 |
+
- name: Test install
|
| 43 |
+
run: |
|
| 44 |
+
pip install .
|
| 45 |
+
|
| 46 |
+
- name: make normal ebook test using google translate and cli
|
| 47 |
+
run: |
|
| 48 |
+
bbook_maker --book_name "test_books/Liber_Esther.epub" --test --test_num 10 --model google --translate-tags div,p
|
| 49 |
+
bbook_maker --book_name "test_books/Liber_Esther.epub" --test --test_num 20 --model google
|
| 50 |
+
|
| 51 |
+
- name: make txt book test using google translate
|
| 52 |
+
run: |
|
| 53 |
+
python3 make_book.py --book_name "test_books/the_little_prince.txt" --test --test_num 20 --model google
|
| 54 |
+
|
| 55 |
+
- name: make txt book test with batch_size
|
| 56 |
+
run: |
|
| 57 |
+
python3 make_book.py --book_name "test_books/the_little_prince.txt" --test --batch_size 30 --test_num 20 --model google
|
| 58 |
+
|
| 59 |
+
- name: make caiyun translator test
|
| 60 |
+
if: env.BBM_CAIYUN_API_KEY != null
|
| 61 |
+
run: |
|
| 62 |
+
python3 make_book.py --book_name "test_books/the_little_prince.txt" --test --batch_size 30 --test_num 100 --model caiyun
|
| 63 |
+
|
| 64 |
+
- name: make openai key ebook test
|
| 65 |
+
if: env.BBM_DEEPL_API_KEY != null
|
| 66 |
+
run: |
|
| 67 |
+
python3 make_book.py --book_name "test_books/lemo.epub" --test --test_num 5 --language zh-hans
|
| 68 |
+
python3 make_book.py --book_name "test_books/animal_farm.epub" --test --test_num 5 --language ja --model gpt3 --prompt prompt_template_sample.txt
|
| 69 |
+
python3 make_book.py --book_name "test_books/animal_farm.epub" --test --test_num 5 --language ja --prompt prompt_template_sample.json
|
| 70 |
+
python3 make_book.py --book_name test_books/Lex_Fridman_episode_322.srt --test --test_num 20
|
| 71 |
+
|
| 72 |
+
- name: Rename and Upload ePub
|
| 73 |
+
if: env.OPENAI_API_KEY != null
|
| 74 |
+
uses: actions/upload-artifact@v2
|
| 75 |
+
with:
|
| 76 |
+
name: epub_output
|
| 77 |
+
path: "test_books/lemo_bilingual.epub"
|