提交 652586f4 编写于 作者: C Corentin Jemine

The toolbox now can handle 0 arguments

上级 0908e4d3
......@@ -10,11 +10,12 @@ if __name__ == '__main__':
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("datasets_root", type=Path, help= \
parser.add_argument("-d", "--datasets_root", type=Path, help= \
"Path to the directory containing your datasets. See toolbox/__init__.py for a list of "
"supported datasets. You can add your own data by created a directory named UserAudio "
"in your datasets root. Supported formats are mp3, flac, wav and m4a. Each speaker should "
"be inside a directory, e.g. <datasets_root>/UserAudio/speaker_01/audio_01.wav.")
"be inside a directory, e.g. <datasets_root>/UserAudio/speaker_01/audio_01.wav.",
default=None)
parser.add_argument("-e", "--enc_models_dir", type=Path, default="encoder/saved_models",
help="Directory containing saved encoder models")
parser.add_argument("-s", "--syn_models_dir", type=Path, default="synthesizer/saved_models",
......
......@@ -210,14 +210,20 @@ class UI(QDialog):
random=True):
# Select a random dataset
if level <= 0:
datasets = [datasets_root.joinpath(d) for d in recognized_datasets]
datasets = [d.relative_to(datasets_root) for d in datasets if d.exists()]
self.browser_load_button.setDisabled(len(datasets) == 0)
if len(datasets) == 0:
print("Warning: you do not have any of the recognized datasets in %s.\n"
"The recognized datasets are:\n\t%s\nFeel free to add your own. You can "
"still use the toolbox by recording samples yourself." %
(datasets_root, "\n\t".join(recognized_datasets)), file=sys.stderr)
if datasets_root is not None:
datasets = [datasets_root.joinpath(d) for d in recognized_datasets]
datasets = [d.relative_to(datasets_root) for d in datasets if d.exists()]
self.browser_load_button.setDisabled(len(datasets) == 0)
if datasets_root is None or len(datasets) == 0:
# Yes I am proud of this two-liner
msg = "Warning: you d" + "id not pass a root directory for datasets as argument" \
if datasets_root is None else "o not have any of the recognized datasets in %s"
self.log(msg)
msg += ".\nThe recognized datasets are:\n\t%s\nFeel free to add your own. You " \
"can still use the toolbox by recording samples yourself." % \
("\n\t".join(recognized_datasets))
print(msg, file=sys.stderr)
self.random_utterance_button.setDisabled(True)
self.random_speaker_button.setDisabled(True)
self.random_dataset_button.setDisabled(True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册