Py.Cafe

kecnry/

ar-cube

data cube in AR

DocsPricing
  • slices/
  • app.py
  • ar.tsx
  • react-three-xr.bundle.js
  • requirements.txt
  • threejs-fiber.bundle.js
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import ipyreact
from pathlib import Path
ipyreact.define_module("@react-three/fiber", Path("./threejs-fiber.bundle.js"))
ipyreact.define_module("@react-three/xr", Path("./react-three-xr.bundle.js"))

from traitlets import default

from glob import glob

pngs = [f"https://py.cafe/files/kecnry/ar-cube/{f[2:]}" for f in sorted(glob('./slices/*png'))]

class XRWidget(ipyreact.Widget):
    _esm = Path("ar.tsx")
page = XRWidget(props={"pngs": pngs})