From 6aa160ec999defb8435a37a5aa2616de5cb4b6c1 Mon Sep 17 00:00:00 2001 From: speech_tts Date: Mon, 17 Oct 2022 04:15:56 +0000 Subject: [PATCH] fix sample code --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 221122b..168397a 100644 --- a/README.md +++ b/README.md @@ -92,19 +92,16 @@ widgets: ```Python from scipy.io.wavfile import write -from modelscope.metainfo import Pipelines -from modelscope.models import Model +from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline -from modelscope.pipelines.outputs import OutputKeys -from modelscope.utils.constant import Tasks, Fields +from modelscope.utils.constant import Tasks text = '待合成文本' -voice = 'zhitian_emo' -model_id = 'damo\speech_sambert-hifigan_tts_zh-cn_16k' +model_id = 'damo/speech_sambert-hifigan_tts_zh-cn_16k' sambert_hifigan_tts = pipeline(task=Tasks.text_to_speech, model=model_id) -output = sambert_hifigan_tts(text, voice) -# save to file output.wav -write('output.wav', 16000, output[OutputKeys.OUTPUT_WAV]) +output = sambert_hifigan_tts(input=text) +pcm = output[OutputKeys.OUTPUT_PCM] +write('output.wav', 16000, pcm) ``` ### 模型局限性以及可能的偏差