Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -473,10 +473,9 @@ def detect_phoneme_from_audio(audio_segment: torch.Tensor, sample_rate: int, wor
|
|
473 |
log(f"🔧 Padding audio from {audio_segment.shape[-1]} to {target_length} samples")
|
474 |
audio_segment = torch.nn.functional.pad(audio_segment, (0, target_length - audio_segment.shape[-1]))
|
475 |
elif audio_segment.shape[-1] > target_length:
|
476 |
-
#
|
477 |
-
|
478 |
-
log(f"
|
479 |
-
audio_segment = audio_segment[:, start_idx:start_idx + target_length]
|
480 |
else:
|
481 |
log(f"✅ Audio segment already correct length: {target_length} samples")
|
482 |
|
|
|
473 |
log(f"🔧 Padding audio from {audio_segment.shape[-1]} to {target_length} samples")
|
474 |
audio_segment = torch.nn.functional.pad(audio_segment, (0, target_length - audio_segment.shape[-1]))
|
475 |
elif audio_segment.shape[-1] > target_length:
|
476 |
+
# Don't truncate long segments - keep full audio for complex words
|
477 |
+
log(f"⚠️ Audio longer than target ({audio_segment.shape[-1]} > {target_length}), keeping full length")
|
478 |
+
log(f" This preserves all phonemes for long words like 'sophisticated'")
|
|
|
479 |
else:
|
480 |
log(f"✅ Audio segment already correct length: {target_length} samples")
|
481 |
|