Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import tempfile ,os
2
  import gradio as gr
 
3
 
4
  MAX_TXT_LEN = 800
5
  def tts(text: str):
@@ -10,9 +11,12 @@ def tts(text: str):
10
  import subprocess
11
 
12
  with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
13
- #print(fp)
14
- output = subprocess.check_output(f'mimic3 --voice fa/haaniye_low "{text}" > {fp.name}', shell=True, stderr=subprocess.STDOUT)
15
- return fp.name
 
 
 
16
 
17
 
18
 
 
1
  import tempfile ,os
2
  import gradio as gr
3
+ import subprocess
4
 
5
  MAX_TXT_LEN = 800
6
  def tts(text: str):
 
11
  import subprocess
12
 
13
  with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
14
+ try:
15
+ subprocess.run(f'mimic3 --voice fa/haaniye_low "{text}" > {fp.name}', shell=True, check=True, stderr=subprocess.PIPE)
16
+ except subprocess.CalledProcessError as e:
17
+ print("Command failed with code", e.returncode)
18
+ print("Output:", e.stderr.decode())
19
+ return fp.name
20
 
21
 
22