import gradio as gr import os from TTS.config import load_config from TTS.utils.manage import ModelManager from TTS.utils.synthesizer import Synthesizer model_path = "./model/model.pth" config_path = "./model/config.json" output_path = "/tmp/" def run_tts(text): synthesizer = Synthesizer( tts_checkpoint=model_path, tts_config_path=config_path, tts_speakers_file=None, tts_languages_file=None, vocoder_checkpoint=None, vocoder_config=None, encoder_checkpoint="", encoder_config="", use_cuda=False, ) wav = synthesizer.tts(text) output_file = os.path.join(output_path, "inference.wav") synthesizer.save_wav(wav, output_file) return output_file iface = gr.Interface(fn=run_tts, inputs="text", outputs="audio", enable_queue=True) iface.launch()