Spaces:
Runtime error
Runtime error
File size: 412 Bytes
9c917b9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import torch
from transformers import pipeline
def transcribe_audio(audio_path):
device = "cpu"
if torch.cuda.is_available():
device = "cuda"
pipe = pipeline(
"automatic-speech-recognition",
model="openai/whisper-small",
device=device,
chunk_length_s=30,
)
return pipe(
audio_path,
batch_size=8,
return_timestamps=True
) |