Talha812's picture
Create stt.py
ee83229 verified
raw
history blame contribute delete
296 Bytes
from faster_whisper import WhisperModel
# Load model once
stt_model = WhisperModel("base", compute_type="int8")
def speech_to_text(audio_file):
segments, _ = stt_model.transcribe(audio_file)
text = ""
for segment in segments:
text += segment.text
return text.strip()