Skip to content
Open
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: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Python things
__pycache__
.pytest_cache

# Editor things
.*.sw?

# venv stuff
.envrc
venv
# setup.py artifacts
dist
build
*.egg-info
6 changes: 4 additions & 2 deletions ovos_tts_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ def synth(request: Request):
utterance = TTS.validate_ssml(utterance)
audio, phonemes = TTS.synth(utterance, **request.query_params)
return FileResponse(audio.path)

return app


def start_tts_server(tts_plugin, cache=False, has_gradio=False):
def start_tts_server(tts_plugin, cache=False, has_gradio=False, lang=None):
global TTS

# load ovos TTS plugin
engine = load_tts_plugin(tts_plugin)

config = Configuration().get("tts", {}).get(tts_plugin, {})
if lang:
config["lang"] = lang
config["persist_cache"] = cache # this will cache every synth even across reboots
TTS = engine(config=config)
TTS.log_timestamps = True # enable logging
Expand Down
2 changes: 1 addition & 1 deletion ovos_tts_server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def main():
args = parser.parse_args()

server, engine = start_tts_server(args.engine, cache=bool(args.cache),
has_gradio=bool(args.gradio))
has_gradio=bool(args.gradio), lang=args.lang)
LOG.info("Server Started")
if args.gradio:
bind_gradio_service(server, engine, args.title, args.description,
Expand Down