Freddolin's picture
Create tools/asr_tool.py
68f7e32 verified
raw
history blame
268 Bytes
from faster_whisper import WhisperModel
import os
model = WhisperModel("small", device="cpu", compute_type="int8")
def transcribe_audio(audio_path: str) -> str:
segments, _ = model.transcribe(audio_path)
return " ".join(segment.text for segment in segments)