Update app.py
Browse files
app.py
CHANGED
@@ -125,7 +125,7 @@ def handle_feedback(feedback):
|
|
125 |
conn.commit()
|
126 |
return "Thank you for your feedback!", None
|
127 |
|
128 |
-
def segment_background_audio(audio_path,
|
129 |
|
130 |
"""
|
131 |
Detects and extracts non-speech (background) segments from audio using pyannote VAD.
|
@@ -171,8 +171,8 @@ def segment_background_audio(audio_path, segment_audio_path="background_segments
|
|
171 |
non_speech_audio += segment
|
172 |
|
173 |
# Step 6: Export the non-speech audio
|
174 |
-
non_speech_audio.export(
|
175 |
-
print(f"🎵 Non-speech audio saved to: {
|
176 |
|
177 |
return background_segments
|
178 |
|
@@ -454,7 +454,7 @@ def process_entry(entry, i, tts_model, video_width, video_height, process_mode,
|
|
454 |
|
455 |
return i, txt_clip, audio_segment, error_message
|
456 |
|
457 |
-
def add_transcript_voiceover(video_path, translated_json, output_path, process_mode, target_language="en", speaker_sample_paths=None,
|
458 |
video = VideoFileClip(video_path)
|
459 |
font_path = "./NotoSansSC-Regular.ttf"
|
460 |
|
|
|
125 |
conn.commit()
|
126 |
return "Thank you for your feedback!", None
|
127 |
|
128 |
+
def segment_background_audio(audio_path, background_audio_path="background_segments.wav"):
|
129 |
|
130 |
"""
|
131 |
Detects and extracts non-speech (background) segments from audio using pyannote VAD.
|
|
|
171 |
non_speech_audio += segment
|
172 |
|
173 |
# Step 6: Export the non-speech audio
|
174 |
+
non_speech_audio.export(background_audio_path, format="wav")
|
175 |
+
print(f"🎵 Non-speech audio saved to: {background_audio_path}")
|
176 |
|
177 |
return background_segments
|
178 |
|
|
|
454 |
|
455 |
return i, txt_clip, audio_segment, error_message
|
456 |
|
457 |
+
def add_transcript_voiceover(video_path, translated_json, output_path, process_mode, target_language="en", speaker_sample_paths=None, background_audio_path="background_segments.wav"):
|
458 |
video = VideoFileClip(video_path)
|
459 |
font_path = "./NotoSansSC-Regular.ttf"
|
460 |
|