diff --git a/mimic3_http/app.py b/mimic3_http/app.py index 006a21d..12f844b 100644 --- a/mimic3_http/app.py +++ b/mimic3_http/app.py @@ -39,6 +39,7 @@ from quart import ( from swagger_ui import api_doc from mimic3_tts import DEFAULT_VOICE, Mimic3Settings, Mimic3TextToSpeechSystem +from mimic3_tts.download import is_voice_downloaded from mimic3_tts.utils import LANG_NAMES, SAMPLE_SENTENCES from ._resources import _DIR, _PACKAGE @@ -317,7 +318,7 @@ def get_app(args: argparse.Namespace, request_queue: Queue, temp_dir: str): tech = "vits" for voice in sorted_voices: - if not voice.location or voice.location.startswith("https://"): + if not is_voice_downloaded(voice.location): # Skip voices that are not yet installed continue if voice.is_multispeaker: diff --git a/mimic3_tts/download.py b/mimic3_tts/download.py index ffcf9f0..ccf0421 100644 --- a/mimic3_tts/download.py +++ b/mimic3_tts/download.py @@ -141,6 +141,11 @@ def download_voice( ) from e +def is_voice_downloaded(voice_location: str) -> bool: + """True if voice has been downloaded locally""" + return voice_location and Path(voice_location).exists() + + # -----------------------------------------------------------------------------