aigmixer commited on
Commit
4eb15f6
1 Parent(s): f8bf4b8

testing piper cli

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -1,16 +1,23 @@
1
  import gradio as gr
2
  import subprocess
 
3
 
4
- def list_dependencies():
5
- # Run 'pip freeze' to list installed packages
6
- result = subprocess.run(["pip", "freeze"], capture_output=True, text=True)
7
- return result.stdout
 
 
 
 
 
 
8
 
9
  demo = gr.Interface(
10
- fn=list_dependencies,
11
- inputs=[], # No inputs required
12
- outputs="text"
13
  )
14
 
15
  if __name__ == "__main__":
16
- demo.launch()
 
1
  import gradio as gr
2
  import subprocess
3
+ import piper
4
 
5
+
6
+ def text_to_speech(text):
7
+ # Command to run Piper CLI
8
+ command = ['piper', '--model', 'model_path.onnx', '--output_file', 'output.wav']
9
+
10
+ # Run Piper CLI with subprocess, passing in text as input
11
+ result = subprocess.run(command, input=text, text=True, capture_output=True)
12
+
13
+ # Return the path to the audio file or handle the output appropriately
14
+ return 'output.wav'
15
 
16
  demo = gr.Interface(
17
+ fn=text_to_speech,
18
+ inputs="text",
19
+ outputs="audio"
20
  )
21
 
22
  if __name__ == "__main__":
23
+ demo.launch(show_api=False)