天问 6f4fb90c82 Update 'README.md' | 9 months ago | |
---|---|---|
README.md | 9 months ago |
注解方式创建命令行接口,argument
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()