File size: 706 Bytes
1945c48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from TTS.tts.configs.xtts_config import XttsConfig
from TTS.tts.models.xtts import Xtts

config = XttsConfig()
config.load_json("/model/config.json")
model = Xtts.init_from_config(config)
model.load_checkpoint(config, checkpoint_dir="/model/", eval=True)
model.cuda()


def generateVoice(prompt):
    outputs = model.synthesize(
        "It took me quite a long time to develop a voice and now that I have it I am not going to be silent.",
        config,
        speaker_wav="/guide_recording/guide.wav",
        gpt_cond_len=3,
        language="es",
        )
    return outputs

demo = gr.Interface(
    fn=generateVoice,
    inputs=["text"],
    outputs=["audio"],
)

demo.launch()