Make ABO Space launch compatible
Browse files
demo.py
CHANGED
|
@@ -6,6 +6,7 @@ from __future__ import annotations
|
|
| 6 |
import os
|
| 7 |
import re
|
| 8 |
import urllib.request
|
|
|
|
| 9 |
from collections import Counter, defaultdict
|
| 10 |
from pathlib import Path
|
| 11 |
from typing import Any
|
|
@@ -360,14 +361,16 @@ def build_demo_view(layouts: dict[str, str]) -> hv.ui.View:
|
|
| 360 |
|
| 361 |
|
| 362 |
def launch_demo(dataset: hv.Dataset, layouts: dict[str, str]) -> hv.Session:
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
|
|
|
|
|
|
| 371 |
session.ui.add_extension(EXTENSION_DIR, workspace_id=WORKSPACE_ID)
|
| 372 |
session.ui.apply_view(
|
| 373 |
build_demo_view(layouts),
|
|
|
|
| 6 |
import os
|
| 7 |
import re
|
| 8 |
import urllib.request
|
| 9 |
+
from inspect import signature
|
| 10 |
from collections import Counter, defaultdict
|
| 11 |
from pathlib import Path
|
| 12 |
from typing import Any
|
|
|
|
| 361 |
|
| 362 |
|
| 363 |
def launch_demo(dataset: hv.Dataset, layouts: dict[str, str]) -> hv.Session:
|
| 364 |
+
launch_kwargs = {
|
| 365 |
+
"host": SPACE_HOST,
|
| 366 |
+
"port": SPACE_PORT,
|
| 367 |
+
"open_browser": False,
|
| 368 |
+
"workspace_id": WORKSPACE_ID,
|
| 369 |
+
}
|
| 370 |
+
if "block" in signature(hv.launch).parameters:
|
| 371 |
+
launch_kwargs["block"] = False
|
| 372 |
+
|
| 373 |
+
session = hv.launch(dataset, **launch_kwargs)
|
| 374 |
session.ui.add_extension(EXTENSION_DIR, workspace_id=WORKSPACE_ID)
|
| 375 |
session.ui.apply_view(
|
| 376 |
build_demo_view(layouts),
|