aigmixer commited on
Commit
cd1c689
1 Parent(s): f69f274

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -1,21 +1,20 @@
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', '--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()
 
1
  import gradio as gr
2
  import subprocess
 
3
 
4
+ def run_command(command):
5
+ try:
6
+ # Running the command and capturing the output
7
+ result = subprocess.run(command, shell=True, text=True, capture_output=True, check=True)
8
+ return result.stdout
9
+ except subprocess.CalledProcessError as e:
10
+ return e.stderr
 
 
11
 
12
  iface = gr.Interface(
13
+ fn=run_command,
14
  inputs='text',
15
+ outputs='text',
16
+ title="CLI Interface",
17
+ description="Enter your command and see the output."
18
  )
19
 
20
  iface.launch()