File size: 730 Bytes
9156a46
 
 
70d6fe3
9156a46
707a844
 
 
ae228f6
9156a46
 
 
0553379
0216dec
9156a46
 
 
 
 
b4b1e84
 
 
 
 
 
 
 
 
 
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
import tempfile ,os
import gradio as gr

MAX_TXT_LEN = 5000
def tts(text: str):
    #if len(text) > MAX_TXT_LEN:
    #    text = text[:MAX_TXT_LEN]
    #    print(f"Input text was cutoff since it went over the {MAX_TXT_LEN} character limit.")
    print(text)
    import subprocess
    
    with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
        #print(fp)
        output = subprocess.check_output(f'mimic3 --voice fa/haaniye_low "{text}" > {fp.name}', shell=True, stderr=subprocess.STDOUT)
        return fp.name



article= ""
iface = gr.Interface(
    fn=tts,
    inputs=[
        gr.Textbox(
            label="Input",
        )
    ],
    outputs=gr.Audio(label="Output",type='filepath')
)
iface.launch()