agorlanov commited on
Commit
2f53d2f
1 Parent(s): d6b32ee

add_filter

Browse files
Files changed (2) hide show
  1. main_pipeline.py +2 -2
  2. utils/denoise_pipeline.py +1 -3
main_pipeline.py CHANGED
@@ -13,6 +13,7 @@ import soundfile as sf
13
 
14
 
15
  def filter_small_speech(segments):
 
16
  durs = segments.groupby('label').sum()
17
  labels = durs[durs['duration'] / durs.sum()['duration'] > 0.015].index
18
  return segments[segments.label.isin(labels)]
@@ -24,7 +25,6 @@ def save_speaker_audios(segments, denoised_audio_path, out_folder='out', out_f=4
24
  out_wav_paths = []
25
 
26
  segments = pd.DataFrame(segments)
27
- segments['duration'] = segments.end - segments.start
28
  segments = filter_small_speech(segments)
29
 
30
  for label in set(segments.label):
@@ -54,7 +54,7 @@ def main_pipeline(audio_path):
54
 
55
  if __name__ == '__main__':
56
  parser = argparse.ArgumentParser()
57
- parser.add_argument('--audio-path', default='podkast.mp3', help='Path to audio')
58
  opt = parser.parse_args()
59
 
60
  for _ in tqdm(range(10)):
 
13
 
14
 
15
  def filter_small_speech(segments):
16
+ segments['duration'] = segments.end - segments.start
17
  durs = segments.groupby('label').sum()
18
  labels = durs[durs['duration'] / durs.sum()['duration'] > 0.015].index
19
  return segments[segments.label.isin(labels)]
 
25
  out_wav_paths = []
26
 
27
  segments = pd.DataFrame(segments)
 
28
  segments = filter_small_speech(segments)
29
 
30
  for label in set(segments.label):
 
54
 
55
  if __name__ == '__main__':
56
  parser = argparse.ArgumentParser()
57
+ parser.add_argument('--audio-path', default='dialog.mp3', help='Path to audio')
58
  opt = parser.parse_args()
59
 
60
  for _ in tqdm(range(10)):
utils/denoise_pipeline.py CHANGED
@@ -1,10 +1,8 @@
1
- import os
2
- import torch
3
- from scipy.io.wavfile import write
4
  import librosa
5
  import torch
6
  from demucs.apply import apply_model
7
  from demucs.pretrained import get_model
 
8
 
9
  # demucs_model = get_model('cfa93e08')
10
  demucs_model = get_model('htdemucs')
 
 
 
 
1
  import librosa
2
  import torch
3
  from demucs.apply import apply_model
4
  from demucs.pretrained import get_model
5
+ from scipy.io.wavfile import write
6
 
7
  # demucs_model = get_model('cfa93e08')
8
  demucs_model = get_model('htdemucs')