kumarakkiy's picture
Discourse filter, exact-phrase search, ANN index (v2 dataset rev pinned)
75d531a verified
Raw
History Blame Contribute Delete
1.87 kB
"""SearchAudio β€” fully-local semantic search over long Hindi audio talks.
Type an English sentence (or speak/upload a Hindi clip) and jump straight to the
moment in a recording where that topic is discussed. Everything runs offline on a
single Windows PC with an NVIDIA GPU.
Pipeline: audio -> ffmpeg normalize -> WhisperX ASR (word timestamps) ->
sentence-packed chunks -> bge-m3 embeddings -> LanceDB index.
Query: text/Hindi-audio -> bge-m3 -> LanceDB hybrid search -> bge-reranker -> results.
"""
__version__ = "0.1.0"
# ---------------------------------------------------------------------------
# Silence a spurious torchcodec warning from pyannote.audio.
#
# WhisperX imports ``whisperx.diarize`` (via its VAD modules), which does
# ``from pyannote.audio import Pipeline`` at module top. pyannote.audio, in turn,
# tries ``import torchcodec`` and β€” if the native libs can't load β€” prints a large
# multi-line UserWarning ("torchcodec is not installed correctly so built-in audio
# decoding will fail ...").
#
# On this Windows box torchcodec's DLLs can't load (the FFmpeg *shared* libraries
# aren't on the DLL search path, and the system FFmpeg is v8, which torchcodec 0.7
# doesn't support). That is harmless for us: SearchAudio never lets torchcodec/pyannote
# decode anything. We normalize every input to 16 kHz mono WAV with the bundled
# ffmpeg.exe, read it with the stdlib ``wave`` module into a numpy array, and hand that
# array to WhisperX + Silero VAD (see app/asr.py). No diarization is used. That is
# exactly the "provide audio in-memory" path the warning itself recommends, so the
# message is pure noise. Filter just this one warning; leave all others intact.
import warnings as _warnings
_warnings.filterwarnings(
"ignore",
message=r"(?s).*torchcodec is not installed correctly.*",
category=UserWarning,
)