CoolFace
Apppublic

Mike0021/zonos2

sourceHugging Faceupdated 4mo agoView on Hugging Face
3likes
backend.py28 linesDownload Raw Back to message
1from __future__ import annotations2 3from dataclasses import dataclass4from typing import Dict5 6# Import TTS message classes so they're available in globals() for deserialization7from .tts import (  # noqa: F4018    BatchTTSBackendMsg,9    TTSSamplingParams,10    TTSUserMsg,11)12from .utils import deserialize_type, serialize_type13 14 15@dataclass16class BaseBackendMsg:17    def encoder(self) -> Dict:18        return serialize_type(self)19 20    @staticmethod21    def decoder(json: Dict) -> BaseBackendMsg:22        return deserialize_type(globals(), json)23 24 25@dataclass26class ExitMsg(BaseBackendMsg):27    pass28