Spaces:
Sleeping
Sleeping
aigmixer
commited on
Commit
·
7febfc4
1
Parent(s):
924e172
updating
Browse files
app.py
CHANGED
|
@@ -1,17 +1,21 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
|
|
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
#
|
| 6 |
-
command = ['
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
iface = gr.Interface(
|
| 12 |
-
fn=
|
| 13 |
-
inputs=
|
| 14 |
-
outputs=
|
| 15 |
)
|
| 16 |
|
| 17 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
+
import piper
|
| 4 |
|
| 5 |
+
def synthesize_speech(text):
|
| 6 |
+
# Command to execute Piper-TTS CLI
|
| 7 |
+
command = ['piper-tts-cli', '--text', text, '--output', 'output.wav']
|
| 8 |
+
subprocess.run(command, capture_output=True)
|
| 9 |
+
|
| 10 |
+
if os.path.exists('output.wav'):
|
| 11 |
+
return 'output.wav'
|
| 12 |
+
else:
|
| 13 |
+
return None
|
| 14 |
|
| 15 |
iface = gr.Interface(
|
| 16 |
+
fn=synthesize_speech,
|
| 17 |
+
inputs='text',
|
| 18 |
+
outputs='audio'
|
| 19 |
)
|
| 20 |
|
| 21 |
iface.launch()
|