File size: 347 Bytes
746bf8f
c5bb903
 
746bf8f
 
 
 
c5bb903
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import torch
from transformers import pipeline

def get_transcribe_transformers(url:str, model: str):
    device = "cuda:0" if torch.cuda.is_available() else "cpu"

    pipe = pipeline("automatic-speech-recognition", model=model, return_timestamps=True, device=device)

    result = pipe(url)

    return result.get("text"), result.get("chunks")