artificialguybr commited on
Commit
0cab5bf
β€’
1 Parent(s): 80b43a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -47,17 +47,17 @@ def process_video(video, high_quality, target_language):
47
 
48
  ffmpeg.input(video_path).output(f"{run_uuid}_output_audio.wav", acodec='pcm_s24le', ar=48000, map='a').run()
49
 
50
- y, sr = sf.read(f"{run_uuid}_output_audio.wav")
51
- y = y.astype(np.float32)
52
- y_denoised = wiener(y)
53
- sf.write(f"{run_uuid}_output_audio_denoised.wav", y_denoised, sr)
54
 
55
- sound = AudioSegment.from_file(f"{run_uuid}_output_audio_denoised.wav", format="wav")
56
- sound = sound.apply_gain(0)
57
- sound = sound.low_pass_filter(3000).high_pass_filter(100)
58
- sound.export(f"{run_uuid}_output_audio_processed.wav", format="wav")
59
 
60
- shell_command = f"ffmpeg -y -i {run_uuid}_output_audio_processed.wav -af lowpass=3000,highpass=100 {run_uuid}_output_audio_final.wav".split(" ")
61
  subprocess.run([item for item in shell_command], capture_output=False, text=True, check=True)
62
 
63
  model = whisper.load_model("base")
 
47
 
48
  ffmpeg.input(video_path).output(f"{run_uuid}_output_audio.wav", acodec='pcm_s24le', ar=48000, map='a').run()
49
 
50
+ #y, sr = sf.read(f"{run_uuid}_output_audio.wav")
51
+ #y = y.astype(np.float32)
52
+ #y_denoised = wiener(y)
53
+ #sf.write(f"{run_uuid}_output_audio_denoised.wav", y_denoised, sr)
54
 
55
+ #sound = AudioSegment.from_file(f"{run_uuid}_output_audio_denoised.wav", format="wav")
56
+ #sound = sound.apply_gain(0)
57
+ #sound = sound.low_pass_filter(3000).high_pass_filter(100)
58
+ #sound.export(f"{run_uuid}_output_audio_processed.wav", format="wav")
59
 
60
+ shell_command = f"ffmpeg -y -i {run_uuid}_output_audio.wav -af lowpass=3000,highpass=100 {run_uuid}_output_audio_final.wav".split(" ")
61
  subprocess.run([item for item in shell_command], capture_output=False, text=True, check=True)
62
 
63
  model = whisper.load_model("base")