README.md 722 B

click

注解方式创建命令行接口,argument

Usage

import os
import click    

@click.command()
@click.option('--ckpt_path', '-m', type=str, default=None, help="Path to the checkpoint file")
@click.option('--text', '-t', type=str, default=None, help="Text to speak")
@click.option('--language', '-l', type=str, default="EN", help="Language of the model")
@click.option('--output_dir', '-o', type=str, default="outputs", help="Path to the output")
def main(ckpt_path, text, language, output_dir):
    if ckpt_path is None:
        raise ValueError("The ckpt_path must be specified")
    
    config_path = os.path.join(os.path.dirname(ckpt_path), 'config.json')

if __name__ == "__main__":
    main()