From f97c45b34fdc29532d1e1f2701c6e2e0d58c83c9 Mon Sep 17 00:00:00 2001 From: Vraj Prajapati Date: Thu, 12 Dec 2024 09:19:48 -0600 Subject: [PATCH] Added arguments to tt-explorer program (#1557) --- tools/explorer/run.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/explorer/run.py b/tools/explorer/run.py index 6e1f8efc4..3b89812ac 100755 --- a/tools/explorer/run.py +++ b/tools/explorer/run.py @@ -5,8 +5,34 @@ # SPDX-License-Identifier: Apache-2.0 import model_explorer +import argparse + +parser = argparse.ArgumentParser(prog="tt-explorer") +parser.add_argument( + "-p", + "--port", + help="Port that model-explorer server will be exposed to", + type=int, + default=8080, +) +parser.add_argument( + "-u", "--url", help="Host URL Address for server", default="localhost" +) +parser.add_argument( + "-q", + "--no-browser", + help="Create server without opening browser tab", + action="store_true", +) + +args = parser.parse_args() # TODO(odjuricic): Hack to make our extension default for .mlir files. # This can be handled better when we switch to our model-explorer fork. model_explorer.extension_manager.ExtensionManager.BUILTIN_ADAPTER_MODULES = [] -model_explorer.visualize(extensions=["tt_adapter"]) +model_explorer.visualize_from_config( + extensions=["tt_adapter"], + no_open_in_browser=args.no_browser, + port=args.port, + host=args.url, +)