aigmixer commited on
Commit
67cadae
2 Parent(s): 479b96c 4eb15f6

Merge branch 'main' of https://huggingface.co/spaces/aigmixer/piper

Browse files
Files changed (2) hide show
  1. app.py +18 -5
  2. requirements.txt +3 -1
app.py CHANGED
@@ -1,10 +1,23 @@
1
- #testing commits
2
  import gradio as gr
 
 
3
 
4
- def greet(name):
5
- return "Hello " + name + "!"
6
 
7
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  if __name__ == "__main__":
10
- demo.launch(show_api=False)
 
 
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)
requirements.txt CHANGED
@@ -1 +1,3 @@
1
- piper-tts
 
 
 
1
+ piper-tts
2
+ piper-phonemize~=1.1.0
3
+ onnxruntime>=1.11.0,<2