4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-10 18:17:31 +08:00

Add viewer version function (#801)

version function

Co-authored-by: Matthew Tancik <tancik@berkeley.edu>
This commit is contained in:
Ethan Weber 2022-10-19 08:54:27 -07:00 committed by GitHub
parent 21eddc4b17
commit 7a8f29f623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,13 @@ warnings.filterwarnings("ignore", category=CryptographyDeprecationWarning)
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
@ -230,8 +237,7 @@ class ViewerState:
)
# 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="=")