Skip to content

Commit

Permalink
fix: update trame to streamline jupyter usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Sep 29, 2023
1 parent d3ff06c commit 21fa6cb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ keywords =
packages = find:
include_package_data = True
install_requires =
trame>=3.2.5
trame>=3.2.7
trame-vuetify
trame-components>=2.2.1
trame-plotly>=3.0.2
Expand Down
11 changes: 1 addition & 10 deletions xaitk_saliency_demo/app/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,14 @@
@TrameApp()
class XaitkSaliency:
def __init__(self, server):
if server is None:
server = get_server()

if isinstance(server, str):
server = get_server(server)

self.server = server
self.server = get_server(server, client_type="vue3")
self._task = None
self._model = None
self._xaitk_config = None
self._image_1 = None
self._image_2 = None
self._layout = None

# Fix version of vue
server.client_type = "vue3"

# State defaults
self.state.setdefault("input_expected", 1)
self.state.update(
Expand Down
6 changes: 1 addition & 5 deletions xaitk_saliency_demo/app/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
from .ml.models import update_ml_device


def jupyter_hub_url_builder(base_url, port, template_name):
return f"{os.environ['JUPYTERHUB_SERVICE_PREFIX']}/proxy/{port}/index.html?ui={template_name[16:]}&reconnect=auto"


async def create_app(server=None):
# Disable logging
engine_logger = logging.getLogger("xaitks_saliency_demo")
Expand All @@ -20,7 +16,7 @@ async def create_app(server=None):
# Create app
app = XaitkSaliency(server)
if os.environ.get("JUPYTERHUB_SERVICE_PREFIX"):
app.gui.iframe_url_builder = jupyter_hub_url_builder
app.gui.iframe_builder = "jupyter-hub"

# Start server and wait for it to be ready
await app.gui.ready
Expand Down
7 changes: 1 addition & 6 deletions xaitk_saliency_demo/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@


def main(server=None, **kwargs):
# Get or create server
if server is None:
server = get_server()

if isinstance(server, str):
server = get_server(server)
server = get_server(server, client_type="vue3")

# CLI
server.cli.add_argument(
Expand Down

0 comments on commit 21fa6cb

Please sign in to comment.