Spaces:
Paused
Paused
File size: 1,664 Bytes
4700ca8 bd30ee0 4700ca8 bd30ee0 4700ca8 bd30ee0 4700ca8 bd30ee0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | """
Visualization helpers for LingBot-Map.
This package is imported by the Space only for GLB export. Keep imports lazy so
optional viewer dependencies like `viser` do not become hard runtime
requirements for the ZeroGPU Gradio app.
"""
from importlib import import_module
__all__ = [
"PointCloudViewer",
"viser_wrapper",
"predictions_to_glb",
"CameraState",
"colorize",
"colorize_np",
"get_vertical_colorbar",
"apply_sky_segmentation",
"segment_sky",
"download_skyseg_model",
"load_or_create_sky_masks",
]
def __getattr__(name):
if name == "predictions_to_glb":
return import_module("lingbot_map.vis.glb_export").predictions_to_glb
if name in {"apply_sky_segmentation", "segment_sky", "download_skyseg_model", "load_or_create_sky_masks"}:
return getattr(import_module("lingbot_map.vis.sky_segmentation"), name)
if name in {"CameraState", "colorize", "colorize_np", "get_vertical_colorbar"}:
return getattr(import_module("lingbot_map.vis.utils"), name)
if name in {"PointCloudViewer", "viser_wrapper"}:
try:
module_name = "lingbot_map.vis.point_cloud_viewer" if name == "PointCloudViewer" else "lingbot_map.vis.viser_wrapper"
return getattr(import_module(module_name), name)
except ModuleNotFoundError as exc:
if exc.name == "viser":
raise ModuleNotFoundError(
"`viser` is not installed. The Hugging Face Space uses GLB preview instead of the live Viser viewer."
) from exc
raise
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|