def get(ctx, model_id): """ Retrieves a model from the repository. """ try: os.makedirs(click.get_app_dir(APP_NAME)) except OSError: pass repo.get_model(model_id, click.get_app_dir(APP_NAME), partial(spin, 'Retrieving model')) click.secho(u'\b\u2713', fg='green', nl=False) click.echo('\033[?25h\n', nl=False) ctx.exit(0)
def get(ctx, model_id): """ Retrieves a model from the repository. """ from kraken import repo try: os.makedirs(click.get_app_dir(APP_NAME)) except OSError: pass message('Retrieving model ', nl=False) repo.get_model(model_id, click.get_app_dir(APP_NAME), partial(message, '.', nl=False)) message('\b\u2713', fg='green', nl=False) message('\033[?25h\n', nl=False) ctx.exit(0)
def get(ctx, model_id): """ Retrieves a model from the repository. """ from kraken import repo try: os.makedirs(click.get_app_dir(APP_NAME)) except OSError: pass message('Retrieving model ', nl=False) filename = repo.get_model(model_id, click.get_app_dir(APP_NAME), partial(message, '.', nl=False)) message('\b\u2713', fg='green', nl=False) message('\033[?25h') message('Model name: {}'.format(filename)) ctx.exit(0)
def get(ctx, model_id): """ Retrieves a model from the repository. """ from kraken import repo try: os.makedirs(click.get_app_dir(APP_NAME)) except OSError: pass with KrakenDownloadProgressBar() as progress: download_task = progress.add_task( 'Processing', total=0, visible=True if not ctx.meta['verbose'] else False) filename = repo.get_model( model_id, click.get_app_dir(APP_NAME), lambda total, advance: progress.update(download_task, total=total, advance=advance)) message(f'Model name: {filename}') ctx.exit(0)