From 8888c4e9b2c287d4a11b1ce99e0869803ed45398 Mon Sep 17 00:00:00 2001 From: Yury Kartynnik Date: Thu, 7 Nov 2024 21:07:30 +0000 Subject: [PATCH] Support specifying model paths as separate arguments Useful with globbing, like `model-explorer **/saved_model.pb` (via `shopt -s globstar`) --- src/server/package/src/model_explorer/cmdline.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server/package/src/model_explorer/cmdline.py b/src/server/package/src/model_explorer/cmdline.py index e705f5d2..e33527d6 100644 --- a/src/server/package/src/model_explorer/cmdline.py +++ b/src/server/package/src/model_explorer/cmdline.py @@ -25,7 +25,7 @@ formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument( - 'model_paths', nargs='?', help='comma separated model file paths' + 'model_paths', nargs='*', help='model file paths, space- or comma-separated' ) parser.add_argument('--host', default=DEFAULT_HOST, help='host of the server') parser.add_argument( @@ -76,9 +76,10 @@ def main(): """Entry point for the command line version of model explorer.""" - model_paths: list[str] = [] - if args.model_paths is not None and args.model_paths != '': - model_paths = [x.strip() for x in args.model_paths.split(',')] + model_paths: list[str] = args.model_paths + if len(args.model_paths) == 1: + comma_separated_model_paths = args.model_paths[0] + model_paths = [x.strip() for x in comma_separated_model_paths.split(',')] node_data_paths: list[str] = [] if args.node_data_paths is not None and args.node_data_paths != '':