Skip to content

Commit

Permalink
Add viewer version function (#801)
Browse files Browse the repository at this point in the history
version function

Co-authored-by: Matthew Tancik <[email protected]>
  • Loading branch information
ethanweber and tancik authored Oct 19, 2022
1 parent 21eddc4 commit 7a8f29f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nerfstudio/viewer/server/viewer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
CONSOLE = Console(width=120)


def get_viewer_version() -> str:
"""Get the version of the viewer."""
json_filename = os.path.join(os.path.dirname(__file__), "../app/package.json")
version = load_from_json(Path(json_filename))["version"]
return version


@check_main_thread
def setup_viewer(config: cfg.ViewerConfig, log_filename: Path):
"""Sets up the viewer if enabled
Expand Down Expand Up @@ -230,8 +237,7 @@ def __init__(self, config: cfg.ViewerConfig, log_filename: Path):
)
# TODO(ethan): log the output of the viewer bridge server in a file where the training logs go
CONSOLE.line()
json_filename = os.path.join(os.path.dirname(__file__), "../app/package.json")
version = load_from_json(Path(json_filename))["version"]
version = get_viewer_version()
websocket_url = f"ws://localhost:{self.config.websocket_port}"
self.viewer_url = f"https://viewer.nerf.studio/versions/{version}/?websocket_url={websocket_url}"
CONSOLE.rule(characters="=")
Expand Down

0 comments on commit 7a8f29f

Please sign in to comment.