mirror of
https://github.com/wassname/TTS.git
synced 2026-09-21 12:40:58 +08:00
Add integration test for server package
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"tts_path":"TTS/tests/outputs/", // tts model root folder
|
||||
"tts_file":"checkpoint_10.pth.tar", // tts checkpoint file
|
||||
"tts_checkpoint":"checkpoint_10.pth.tar", // tts checkpoint file
|
||||
"tts_config":"dummy_model_config.json", // tts config.json file
|
||||
"tts_speakers": null, // json file listing speaker ids. null if no speaker embedding.
|
||||
"wavernn_lib_path": null, // Rootpath to wavernn project folder to be imported. If this is null, model uses GL for speech synthesis.
|
||||
|
||||
@@ -20,6 +20,8 @@ class DemoServerTest(unittest.TestCase):
|
||||
def test_in_out(self):
|
||||
self._create_random_model()
|
||||
config = load_config(os.path.join(get_tests_input_path(), 'server_config.json'))
|
||||
config['tts_path'] = get_tests_output_path()
|
||||
tts_root_path = get_tests_output_path()
|
||||
config['tts_checkpoint'] = os.path.join(tts_root_path, config['tts_checkpoint'])
|
||||
config['tts_config'] = os.path.join(tts_root_path, config['tts_config'])
|
||||
synthesizer = Synthesizer(config)
|
||||
synthesizer.tts("Better this test works!!")
|
||||
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
set -xe
|
||||
|
||||
if [[ ! -f tests/outputs/checkpoint_10.pth.tar ]]; then
|
||||
echo "Missing dummy model in tests/outputs. This test needs to run after the Python unittests have been run."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python -m venv /tmp/venv
|
||||
source /tmp/venv/bin/activate
|
||||
pip install --quiet --upgrade pip setuptools wheel
|
||||
|
||||
rm -f dist/*.whl
|
||||
python setup.py bdist_wheel --checkpoint tests/outputs/checkpoint_10.pth.tar --model_config tests/outputs/dummy_model_config.json
|
||||
pip install --quiet dist/TTS*.whl
|
||||
|
||||
python -m TTS.server.server &
|
||||
SERVER_PID=$!
|
||||
|
||||
echo 'Waiting for server...'
|
||||
sleep 30
|
||||
|
||||
curl -o /tmp/audio.wav "http://localhost:5002/api/tts?text=synthesis%20schmynthesis"
|
||||
python -c 'import sys; import wave; print(wave.open(sys.argv[1]).getnframes())' /tmp/audio.wav
|
||||
|
||||
kill $SERVER_PID
|
||||
|
||||
deactivate
|
||||
rm -rf /tmp/venv
|
||||
|
||||
rm /tmp/audio.wav
|
||||
rm dist/*.whl
|
||||
Reference in New Issue
Block a user