File size: 441 Bytes
6249bc9
 
 
 
 
 
 
195e557
 
6249bc9
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from transformers import pipeline

class Transcriber:
    def __init__(self, pipe: pipeline) -> None:
        self.pipe = pipe

    def transcribe(self, file_path: str = "yt_audio.mp3") -> str:
        print(self.pipe)
        print("Audo file at:", file_path)
        try:
            transcription = self.pipe(file_path)["text"]
            return transcription
        except:
            return "ERROR: No audio file found to transcribe"