add python API and examples for TTS (#364)
This commit is contained in:
20
.github/scripts/test-python.sh
vendored
20
.github/scripts/test-python.sh
vendored
@@ -8,6 +8,24 @@ log() {
|
||||
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
|
||||
}
|
||||
|
||||
log "Offline TTS test"
|
||||
|
||||
wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/vits-ljs.onnx
|
||||
wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/lexicon.txt
|
||||
wget -qq https://huggingface.co/csukuangfj/vits-ljs/resolve/main/tokens.txt
|
||||
|
||||
python3 ./python-api-examples/offline-tts.py \
|
||||
--vits-model=./vits-ljs.onnx \
|
||||
--vits-lexicon=./lexicon.txt \
|
||||
--vits-tokens=./tokens.txt \
|
||||
--output-filename=./tts.wav \
|
||||
'liliana, the most beautiful and lovely assistant of our team!'
|
||||
|
||||
ls -lh ./tts.wav
|
||||
file ./tts.wav
|
||||
|
||||
rm -v vits-ljs.onnx ./lexicon.txt ./tokens.txt
|
||||
|
||||
mkdir -p /tmp/icefall-models
|
||||
dir=/tmp/icefall-models
|
||||
|
||||
@@ -171,3 +189,5 @@ rm -rf $repo
|
||||
git clone https://github.com/pkufool/sherpa-test-data /tmp/sherpa-test-data
|
||||
|
||||
python3 sherpa-onnx/python/tests/test_text2token.py --verbose
|
||||
|
||||
rm -rf /tmp/sherpa-test-data
|
||||
|
||||
9
.github/workflows/run-python-test.yaml
vendored
9
.github/workflows/run-python-test.yaml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
python-version: "3.10"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
- name: Install Python dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m pip install --upgrade pip numpy sentencepiece==0.1.96
|
||||
python3 -m pip install --upgrade pip numpy sentencepiece==0.1.96 soundfile
|
||||
|
||||
- name: Install sherpa-onnx
|
||||
shell: bash
|
||||
@@ -65,3 +65,8 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
.github/scripts/test-python.sh
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: tts-generated-test-files
|
||||
path: tts.wav
|
||||
|
||||
Reference in New Issue
Block a user