from pathlib import Path import whisper from typing import Any def preprocess_audio(filepath: str) -> Any: # load audio and pad/trim it to fit 30 seconds audio = whisper.load_audio(filepath) audio = whisper.pad_or_trim(audio) return audio def parsing_text(filepath: str): path = Path(filepath) if path.suffix.lower() not in ('.txt', '.md'): raise ValueError("Invalid file type. Only '.txt' and '.md' files are supported.") return path.read_text()