Spaces:
Sleeping
Sleeping
File size: 649 Bytes
dfe177d 17fdc74 dfe177d 17fdc74 dfe177d 62522ae dfe177d 17fdc74 dfe177d 4df0d17 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import os
import whisper
import logging
# Add FFmpeg directory to PATH
# os.environ["PATH"] += os.pathsep + r"C:\ffmpeg\bin"
WHISPER_MODEL_DIR = "./data/whisper-small"
os.makedirs(WHISPER_MODEL_DIR, exist_ok=True)
model = whisper.load_model("small", download_root=WHISPER_MODEL_DIR)
# def transcribe_audio(file_path: str) -> str:
# result = model.transcribe(file_path)
# return result["text"]
logging.basicConfig(level=logging.INFO)
def transcribe_audio(file_path):
logging.info("Starting transcription for %s", file_path)
result = model.transcribe(file_path)
logging.info("Transcription completed")
return result["text"]
|