forked from coqui-ai/TTS
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpredict.py
More file actions
26 lines (19 loc) · 733 Bytes
/
predict.py
File metadata and controls
26 lines (19 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Prediction interface for Cog ⚙️
# https://github.com/replicate/cog/blob/main/docs/python.md
from cog import BasePredictor, Input, Path
from TTS.api import TTS
class Predictor(BasePredictor):
def setup(self) -> None:
self.model = TTS("tts_models/multilingual/multi-dataset/xtts_v1", gpu=True)
def predict(
self,
text: str = Input(description="Text to synthesize"),
language: str = Input(description="Language"),
speaker_wav: Path = Input(description="Original speaker audio")
) -> Path:
path = self.model.tts_to_file(text=text,
file_path = "output.wav",
speaker_wav = speaker_wav,
language= language
)
return Path(path)