File size: 777 Bytes
f5fcce9
af77b1d
 
8e3a6c8
 
 
 
526c607
8e3a6c8
07f437a
8e3a6c8
 
 
 
0e13645
 
 
 
 
 
 
 
 
 
 
8e3a6c8
0e13645
 
cd46ed3
0e13645
 
 
ae14a36
 
3d98234
526c607
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
29
30
31
32
33
34
35
36
37
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()