lab: preview GLBs + gated downloads for articulated-storage-and-appliances

#1
by sofiayx - opened
Files changed (1) hide show
  1. index.html +8 -2
index.html CHANGED
@@ -240,9 +240,15 @@ import { DRACOLoader } from "three/addons/loaders/DRACOLoader.js";
240
  // overrides for local testing against a plain directory layout.
241
  const LOCAL_BASE = new URLSearchParams(location.search).get("base");
242
  const HFDS = "https://huggingface.co/datasets/projectsim";
 
 
 
243
  const dsUrl = (ds, path) => LOCAL_BASE
244
  ? `${LOCAL_BASE}/${ds}/${path}`
 
245
  : `${HFDS}/${ds}/resolve/main/${path}`;
 
 
246
  const stage = document.getElementById("stage");
247
  const renderer = new THREE.WebGLRenderer({ antialias: true });
248
  renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
@@ -454,7 +460,7 @@ function openCmd(env, cls, item) {
454
 
455
  function cmdFor(env, cls, item) {
456
  if (env === "auto") return autoScript(cls, item);
457
- const head = `mkdir -p projectsim-assets && cd projectsim-assets\npip install -q huggingface_hub\n\n`;
458
  const naNote = naOn(envById(env))
459
  ? `# ${envById(env).label} doesn't run on ${OS_LABEL} β€” run this on a\n` +
460
  `# Linux/Windows box with an NVIDIA RTX GPU (or a cloud instance).\n\n`
@@ -489,7 +495,7 @@ function autoScript(cls, item) {
489
  `PY`;
490
  return `# Paste in a macOS/Linux terminal β€” finds your installed engine.\n` +
491
  `mkdir -p projectsim-assets && cd projectsim-assets\n` +
492
- `pip install -q huggingface_hub\n\n` +
493
  `if [ -n "$ISAAC_SIM" ] && [ -x "$ISAAC_SIM/python.sh" ]; then\n` +
494
  ` echo "β†’ Isaac Sim"\n` +
495
  ` ${dl([`${id}.usda`, "textures/**"])}\n` +
 
240
  // overrides for local testing against a plain directory layout.
241
  const LOCAL_BASE = new URLSearchParams(location.search).get("base");
242
  const HFDS = "https://huggingface.co/datasets/projectsim";
243
+ // Gated datasets: viewer GLBs come from the public preview mirror; downloads stay gated.
244
+ const PREVIEW = "https://huggingface.co/datasets/projectsim/lab-preview/resolve/main";
245
+ const GATED = new Set(["articulated-storage-and-appliances"]);
246
  const dsUrl = (ds, path) => LOCAL_BASE
247
  ? `${LOCAL_BASE}/${ds}/${path}`
248
+ : GATED.has(ds) ? `${PREVIEW}/${ds}/${path}`
249
  : `${HFDS}/${ds}/resolve/main/${path}`;
250
+ const auth = cls => GATED.has(cls.dataset)
251
+ ? `# gated: accept access at ${HFDS}/${cls.dataset} first\nhf auth login\n\n` : "";
252
  const stage = document.getElementById("stage");
253
  const renderer = new THREE.WebGLRenderer({ antialias: true });
254
  renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
 
460
 
461
  function cmdFor(env, cls, item) {
462
  if (env === "auto") return autoScript(cls, item);
463
+ const head = `mkdir -p projectsim-assets && cd projectsim-assets\npip install -q huggingface_hub\n\n` + auth(cls);
464
  const naNote = naOn(envById(env))
465
  ? `# ${envById(env).label} doesn't run on ${OS_LABEL} β€” run this on a\n` +
466
  `# Linux/Windows box with an NVIDIA RTX GPU (or a cloud instance).\n\n`
 
495
  `PY`;
496
  return `# Paste in a macOS/Linux terminal β€” finds your installed engine.\n` +
497
  `mkdir -p projectsim-assets && cd projectsim-assets\n` +
498
+ `pip install -q huggingface_hub\n\n` + auth(cls) +
499
  `if [ -n "$ISAAC_SIM" ] && [ -x "$ISAAC_SIM/python.sh" ]; then\n` +
500
  ` echo "β†’ Isaac Sim"\n` +
501
  ` ${dl([`${id}.usda`, "textures/**"])}\n` +