Spaces:
Running
Running
File size: 594 Bytes
f845b05 f8bf4b8 4eb15f6 f845b05 4eb15f6 f8bf4b8 4eb15f6 f8bf4b8 f845b05 4eb15f6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
import subprocess
import piper
def text_to_speech(text):
# Command to run Piper CLI
command = ['piper', '--model', 'model_path.onnx', '--output_file', 'output.wav']
# Run Piper CLI with subprocess, passing in text as input
result = subprocess.run(command, input=text, text=True, capture_output=True)
# Return the path to the audio file or handle the output appropriately
return 'output.wav'
demo = gr.Interface(
fn=text_to_speech,
inputs="text",
outputs="audio"
)
if __name__ == "__main__":
demo.launch(show_api=False)
|