Skip to content

Commit

Permalink
fix tts env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Yangqing committed Nov 8, 2023
1 parent 2c809ae commit a26dbda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
16 changes: 10 additions & 6 deletions advanced/tts/tts_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
)


# By using XTTS you agree to CPML license https://coqui.ai/cpml
os.environ["COQUI_TOS_AGREED"] = "1"


class Speaker(Photon):
"""
A TTS service that supports multiple models provided by coqui and others.
Expand All @@ -39,7 +35,7 @@ class Speaker(Photon):

MODEL_NAME = "tts_models/en/vctk/vits"
# Or, you can choose some other models
#MODEL_NAME = "tts_models/multilingual/multi-dataset/xtts_v1"
# MODEL_NAME = "tts_models/multilingual/multi-dataset/xtts_v1"

# If you want to load multiple models at the same time, you can put it here
# as a comma-separated string. For example:
Expand All @@ -52,6 +48,10 @@ def init(self):
"""
Initialize a default model.
"""

# By using XTTS you agree to CPML license https://coqui.ai/cpml
os.environ["COQUI_TOS_AGREED"] = "1"

from TTS.api import TTS

self._models: Dict[Union[str, None], TTS] = {}
Expand All @@ -60,7 +60,11 @@ def init(self):
self.MODEL_NAME = os.environ.get("MODEL_NAME", self.MODEL_NAME).strip()

self.PRELOAD_MODELS = [
m for m in os.environ.get("PRELOAD_MODELS", self.PRELOAD_MODELS).strip().split(",") if m
m
for m in os.environ.get("PRELOAD_MODELS", self.PRELOAD_MODELS)
.strip()
.split(",")
if m
]
if self.MODEL_NAME not in self.PRELOAD_MODELS:
self.PRELOAD_MODELS.append(self.MODEL_NAME)
Expand Down
7 changes: 4 additions & 3 deletions advanced/tts/xtts_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
get_file_content,
)

# By using XTTS you agree to CPML license https://coqui.ai/cpml
os.environ["COQUI_TOS_AGREED"] = "1"


class XTTSSpeaker(Photon):
"""
Expand All @@ -42,6 +39,10 @@ def init(self):
"""
Initialize a default model.
"""

# By using XTTS you agree to CPML license https://coqui.ai/cpml
os.environ["COQUI_TOS_AGREED"] = "1"

import torch
from TTS.tts.configs.xtts_config import XttsConfig
from TTS.tts.models.xtts import Xtts
Expand Down

0 comments on commit a26dbda

Please sign in to comment.