Spaces:
Running
Running
Merge branch 'main' of https://huggingface.co/spaces/aigmixer/piper
Browse files- app.py +18 -5
- 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 |
-
|
|
|
|
|
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
|