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()