Spaces:
Sleeping
Sleeping
| 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 | |