gorkemgoknar commited on
Commit
5b0db06
1 Parent(s): f05e79d

after processing should generate unique filename for microphone

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import os,stat
3
  import subprocess
4
  import random
5
  from zipfile import ZipFile
 
6
 
7
  # By using XTTS you agree to CPML license https://coqui.ai/cpml
8
  os.environ["COQUI_TOS_AGREED"] = "1"
@@ -83,7 +84,7 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic,no_lang_aut
83
  # better to remove silence in beginning and end for microphone
84
  trim_silence="areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02,areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02"
85
 
86
- out_filename = mic_file_path + str(random.randint(1,9999)) + ".wav" #ffmpeg to know output format
87
 
88
  #we will use newer ffmpeg as that has afftn denoise filter
89
  shell_command = f"./ffmpeg -y -i {mic_file_path} -af {lowpass_highpass}{fast_denoise},{trim_silence},loudnorm {out_filename}".split(" ")
 
3
  import subprocess
4
  import random
5
  from zipfile import ZipFile
6
+ import uuid
7
 
8
  # By using XTTS you agree to CPML license https://coqui.ai/cpml
9
  os.environ["COQUI_TOS_AGREED"] = "1"
 
84
  # better to remove silence in beginning and end for microphone
85
  trim_silence="areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02,areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02"
86
 
87
+ out_filename = mic_file_path + str(uuid.uuid4()) + ".wav" #ffmpeg to know output format
88
 
89
  #we will use newer ffmpeg as that has afftn denoise filter
90
  shell_command = f"./ffmpeg -y -i {mic_file_path} -af {lowpass_highpass}{fast_denoise},{trim_silence},loudnorm {out_filename}".split(" ")