File size: 255 Bytes
dfe177d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import os

# Add FFmpeg directory to PATH
os.environ["PATH"] += os.pathsep + r"C:\ffmpeg\bin"

import whisper

model = whisper.load_model("small")

def transcribe_audio(file_path: str) -> str:
  result = model.transcribe(file_path)
  return result["text"]