TTS-whisper-small / app /model.py
abhinavvvvv's picture
latency fixed
331a700
raw
history blame contribute delete
395 Bytes
import torch
from transformers import pipeline
MODEL_NAME = "openai/whisper-small"
def load_model():
torch.set_num_threads(2) # Important for HF free CPU
device = 0 if torch.cuda.is_available() else -1
asr_pipeline = pipeline(
"automatic-speech-recognition",
model=MODEL_NAME,
device=device,
chunk_length_s=20,
stride_length_s=5,
)
return asr_pipeline