File size: 1,061 Bytes
7c82c6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)