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, output_path="background_segments.wav"
|
129 |
|
130 |
"""
|
131 |
Detects and extracts non-speech (background) segments from audio using pyannote VAD.
|
@@ -138,11 +138,9 @@ def segment_background_audio(audio_path, output_path="background_segments.wav",
|
|
138 |
Returns:
|
139 |
- List of non-speech timestamp tuples (start, end) in seconds.
|
140 |
"""
|
141 |
-
if not hf_token:
|
142 |
-
raise ValueError("Hugging Face token is required for pyannote pipeline.")
|
143 |
|
144 |
# Step 1: Load pipeline
|
145 |
-
pipeline = Pipeline.from_pretrained("pyannote/voice-activity-detection", use_auth_token=
|
146 |
|
147 |
# Step 2: Apply VAD to get speech segments
|
148 |
vad_result = pipeline(audio_path)
|
|
|
125 |
conn.commit()
|
126 |
return "Thank you for your feedback!", None
|
127 |
|
128 |
+
def segment_background_audio(audio_path, output_path="background_segments.wav"):
|
129 |
|
130 |
"""
|
131 |
Detects and extracts non-speech (background) segments from audio using pyannote VAD.
|
|
|
138 |
Returns:
|
139 |
- List of non-speech timestamp tuples (start, end) in seconds.
|
140 |
"""
|
|
|
|
|
141 |
|
142 |
# Step 1: Load pipeline
|
143 |
+
pipeline = Pipeline.from_pretrained("pyannote/voice-activity-detection", use_auth_token=hf_api_key)
|
144 |
|
145 |
# Step 2: Apply VAD to get speech segments
|
146 |
vad_result = pipeline(audio_path)
|