awinml's picture
Duplicate from DeepLearning101/Telephone-Interviewing_PpaddleSpeech-TTS
7c82c6e
import gradio as gr
import os
from paddlespeech.cli.tts.infer import TTSExecutor
tts_executor = TTSExecutor()
def inference(text: str) -> os.PathLike:
assert isinstance(text, str) and len(text) > 0, 'Input Chinese text...'
wav_file = tts_executor(text=text)
return wav_file
description = "用 PaddleSpeech-TTS 來生成電話訪問的語音內容"
article = "<p style='text-align: center'><a href='https://github.com/PaddlePaddle/PaddleSpeech' target='_blank'>Github Repo</a></p>"
examples=[['我比較想試試看換成自己的聲音來輸出'], ['你是不是也想試試看如果可以變成自己的聲音輸出呢'], ['這個可能會有點久']]
gr.Interface(
inference,
gr.inputs.Textbox(label="input text",lines=10),
gr.outputs.Audio(type="filepath", label="Output"),
title="<p style='text-align: center'><a href='https://www.twman.org/AI' target='_blank'>電話訪問:PaddleSpeech-TTS</a>",
description=description,
article=article,
enable_queue=True,
examples=examples
).launch(debug=True)