File size: 299 Bytes
68f7e32
 
464e3d9
68f7e32
 
 
464e3d9
 
1
2
3
4
5
6
7
8
9
from faster_whisper import WhisperModel

model = WhisperModel("base", device="cpu")

def transcribe_audio(audio_path: str) -> str:
    segments, _ = model.transcribe(audio_path)
    transcription = " ".join(segment.text for segment in segments)
    return transcription or "No transcription found."