{ "cells": [ { "cell_type": "markdown", "id": "3c00934d-0f14-4c1a-a563-94d627b377e5", "metadata": {}, "source": [ "# Programming the viewer\n", "\n", "The real-time web viewer enables communication between Python and the ReactJS Client Viewer Application. Here we provide a walkthrough for how to use the viewer to draw information as well as read information from the GUI.\n" ] }, { "cell_type": "code", "execution_count": 72, "id": "b15dfdc1-5054-40bc-9631-4c7426eecfd9", "metadata": { "tags": [ "remove-cell" ] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The autoreload extension is already loaded. To reload it, use:\n", " %reload_ext autoreload\n" ] } ], "source": [ "# HIDDEN\n", "%load_ext autoreload\n", "%autoreload 2\n", "import pprint\n", "import torch\n", "import numpy as np\n", "import torch\n", "import mediapy as media\n", "from nerfactory.data.structs import SceneBounds\n", "from nerfactory.cameras.cameras import PinholeCamera\n", "import time" ] }, { "cell_type": "markdown", "id": "a8709c84", "metadata": {}, "source": [ "## Open the Nerfviewer client\n", "\n", "Open the Nerfviewer client by visiting http://nerfviewer.plenoptix.ai/ or running the code locally. *We refer to this document for running the code locally.* You should see a GUI like the following:\n", "\n", "```{image} imgs/nerfviewer.png\n", ":align: center\n", ":class: only-light\n", ":width: 600\n", "```" ] }, { "cell_type": "markdown", "id": "052af8ce", "metadata": {}, "source": [ "## Start the Bridge Server\n", "\n", "Run the following code in the repository home directory\n", "\n", "```\n", "python scripts/run_viewer_bridge_server.py\n", "```\n", "\n", "This will start the bridge server that both the Python code and Client Viewer App will connect to.\n", "\n", "Verify that the Client Viewer App is connected." ] }, { "cell_type": "code", "execution_count": 73, "id": "189b2282", "metadata": {}, "outputs": [], "source": [ "# from IPython.display import HTML\n", "\n", "# url=\"http://localhost:4000/?localhost:18051\"\n", "# height = 500\n", "\n", "# HTML(\"\"\"\n", "#