File size: 444 Bytes
f845b05
f8bf4b8
7febfc4
f845b05
7febfc4
 
 
 
 
 
 
 
 
4eb15f6
418b839
7febfc4
 
 
f8bf4b8
f845b05
418b839
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import subprocess
import piper

def synthesize_speech(text):
    # Command to execute Piper-TTS CLI
    command = ['piper-tts-cli', '--text', text, '--output', 'output.wav']
    subprocess.run(command, capture_output=True)

    if os.path.exists('output.wav'):
        return 'output.wav'
    else:
        return None

iface = gr.Interface(
    fn=synthesize_speech,
    inputs='text',
    outputs='audio'
)

iface.launch()