From 27b56e14d7b2f12033a87192f4d396e724f549e5 Mon Sep 17 00:00:00 2001 From: Paillat Date: Sun, 21 Apr 2024 21:51:05 +0200 Subject: [PATCH] :coffin: Remove unused functions --- src/engines/TTSEngine/BaseTTSEngine.py | 41 +------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/src/engines/TTSEngine/BaseTTSEngine.py b/src/engines/TTSEngine/BaseTTSEngine.py index ddea648..6de9f86 100644 --- a/src/engines/TTSEngine/BaseTTSEngine.py +++ b/src/engines/TTSEngine/BaseTTSEngine.py @@ -16,48 +16,9 @@ class Word(TypedDict): class BaseTTSEngine(BaseEngine): @abstractmethod - def synthesize(self, text: str, path: str) -> None: + def synthesize(self, text: str, path: str) -> float: pass - def remove_punctuation(self, text: str) -> str: - return text.translate(str.maketrans("", "", ".,!?;:")) - - def time_with_whisper(self, path: str) -> list[Word]: - """ - Transcribes the audio file at the given path using a pre-trained model and returns a list of words. - - Args: - path (str): The path to the audio file. - - Returns: - list[Word]: A list of Word objects representing the transcribed words. - Example: - ```json - [ - { - "start": "0.00", - "end": "0.50", - "text": "Hello" - }, - { - "start": "0.50", - "end": "1.00", - "text": "world" - } - ] - ``` - """ - device = "cuda" if is_available() else "cpu" - audio = wt.load_audio(path) - model = wt.load_model("large-v3", device=device) - - result = wt.transcribe(model=model, audio=audio) - results = [word for chunk in result["segments"] for word in chunk["words"]] - for result in results: - # Not needed for the current use case - del result["confidence"] - return results - def force_duration(self, duration: float, path: str): """ Forces the audio clip at the given path to have the specified duration.