voice-changer/server/voice_changer/utils/VoiceChangerModel.py

31 lines
873 B
Python
Raw Normal View History

2023-04-28 00:39:51 +03:00
from typing import Any, Protocol, TypeAlias
import numpy as np
2023-04-28 00:39:51 +03:00
from voice_changer.utils.LoadModelParams import LoadModelParams
AudioInOut: TypeAlias = np.ndarray[Any, np.dtype[np.int16]]
2023-07-01 10:45:25 +03:00
PitchfInOut: TypeAlias = np.ndarray[Any, np.dtype[np.int16]]
FeatureInOut: TypeAlias = np.ndarray[Any, np.dtype[np.int16]]
class VoiceChangerModel(Protocol):
2023-04-28 00:39:51 +03:00
# loadModel: Callable[..., dict[str, Any]]
def loadModel(self, params: LoadModelParams):
...
def get_processing_sampling_rate(self) -> int:
...
def get_info(self) -> dict[str, Any]:
...
def inference(self, data: tuple[Any, ...]) -> Any:
...
2023-06-21 03:18:51 +03:00
def generate_input(self, newData: AudioInOut, inputSize: int, crossfadeSize: int, solaSearchFrame: int) -> tuple[Any, ...]:
2023-04-28 00:39:51 +03:00
...
2023-06-21 03:18:51 +03:00
def update_settings(self, key: str, val: int | float | str) -> bool:
2023-04-28 00:39:51 +03:00
...