easyreadDemo / src /libs /tts.py
system's picture
system HF Staff
Deploy 53c0813 from hugging_face
1c57e18 verified
Raw History Blame Contribute Delete
562 Bytes
# Abstract Base Class For Text-to-Speech (TTS) Engines
from abc import ABC, abstractmethod
class BaseTTS(ABC):
@abstractmethod
def __init__(self, config):
pass
@abstractmethod
def synthesize_one(self, text) -> bytes | str:
# Synthesize a single text input and return the audio data (e.g., as bytes or a file path)
pass
@abstractmethod
def synthesize_batch(self, texts) -> list[bytes | str]:
# Synthesize a batch of text inputs and return a list of audio data (e.g., as bytes or file paths)
pass