BoldActionMan commited on
Commit
1dc13e9
1 Parent(s): 7ce119a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -52,13 +52,13 @@ def process_video(video_file, language_choice):
52
  audio = AudioSegment.from_file(reference_audio)
53
  resampled_audio = audio.set_frame_rate(48000)
54
  resampled_audio.export(reference_audio, format="wav")
55
- audio_clip = AudioFileClip(reference_audio)
56
 
57
  # Enhance the audio
58
  model, df_state, _ = init_df()
59
  audio, _ = load_audio(reference_audio, sr=df_state.sr())
60
  enhanced = enhance(model, df_state, audio)
61
  save_audio(reference_audio, enhanced, df_state.sr())
 
62
 
63
  src_path = os.path.join(output_dir, "tmp.wav")
64
 
@@ -158,7 +158,7 @@ def process_video(video_file, language_choice):
158
  start, end, translated_text = segment
159
  segment_path = os.path.join(output_dir, f'segment_{start}_{end}.wav')
160
  model.tts_to_file(translated_text, speaker_id, segment_path, speed=speed)
161
-
162
  reference_speaker = AudioFileClip.subclip(audio_clip, int(start), int(end)) # This is the voice you want to clone
163
  reference_speaker.write_audiofile("reference_speaker.wav")
164
  target_se, audio_name = se_extractor.get_se("reference_speaker.wav", tone_color_converter, vad=False)
 
52
  audio = AudioSegment.from_file(reference_audio)
53
  resampled_audio = audio.set_frame_rate(48000)
54
  resampled_audio.export(reference_audio, format="wav")
 
55
 
56
  # Enhance the audio
57
  model, df_state, _ = init_df()
58
  audio, _ = load_audio(reference_audio, sr=df_state.sr())
59
  enhanced = enhance(model, df_state, audio)
60
  save_audio(reference_audio, enhanced, df_state.sr())
61
+ audio_clip = AudioFileClip(reference_audio)
62
 
63
  src_path = os.path.join(output_dir, "tmp.wav")
64
 
 
158
  start, end, translated_text = segment
159
  segment_path = os.path.join(output_dir, f'segment_{start}_{end}.wav')
160
  model.tts_to_file(translated_text, speaker_id, segment_path, speed=speed)
161
+ print(start)
162
  reference_speaker = AudioFileClip.subclip(audio_clip, int(start), int(end)) # This is the voice you want to clone
163
  reference_speaker.write_audiofile("reference_speaker.wav")
164
  target_se, audio_name = se_extractor.get_se("reference_speaker.wav", tone_color_converter, vad=False)