Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tts lock and env #57

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 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,9 @@ 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).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