import tempfile import gradio as gr from synthesize import synthesize, load_model from synthesis.vocoders import Hifigan model = load_model("checkpoints/checkpoint_9000.zip") vocoder = Hifigan("weights/custom_pctest/model.pt", "weights/custom_pctest/config.json") title = "Text-to-Speech (TTS) model for Priyanka Chopra's voice" description = "Generate english speech from text using a Tacotron2 model" \ article = """

Blog

""" examples = ["Generate english speech from text using a Tacotron2 model.", "Two roads diverged in a wood, I took the one less traveled by, And that has made all the difference."] def inference(text: str): synthesize( model=model, text=text, graph_path="graph.png", audio_path="audio.wav", vocoder=vocoder, ) return "audio.wav" gr.Interface( fn=inference, inputs=[ gr.inputs.Textbox( label="Input", default=examples[0], ), ], outputs=gr.outputs.Audio(label="Output"), title=title, description=description, article=article, examples=examples, enable_queue=True, allow_flagging=False, ).launch(debug=False)