Efradeca commited on
Commit
c129ebe
·
verified ·
1 Parent(s): 2a770e2

chore: deploy private lightloom build

Browse files
.gitattributes CHANGED
@@ -34,3 +34,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  2406.09394v4.pdf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  2406.09394v4.pdf filter=lfs diff=lfs merge=lfs -text
37
+ frontend/assets/corridor/scene-0.webp filter=lfs diff=lfs merge=lfs -text
38
+ frontend/assets/corridor/scene-1.webp filter=lfs diff=lfs merge=lfs -text
39
+ frontend/assets/corridor/scene-2-depth.png filter=lfs diff=lfs merge=lfs -text
40
+ frontend/assets/corridor/scene-2.webp filter=lfs diff=lfs merge=lfs -text
41
+ frontend/assets/corridor/scene-3.webp filter=lfs diff=lfs merge=lfs -text
42
+ frontend/assets/corridor/scene-4.webp filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -47,12 +47,16 @@ assets/anchors/generated/*
47
  frontend/.cache/
48
 
49
  # Showcase reel assets ARE part of the product: pre-rendered by the app's own
50
- # /panorama endpoint (scripts/build_showcase.py), bundled so anon-quota visitors
51
- # see the full experience instantly. Un-ignore them despite the blanket *.webp/*.png.
52
  !frontend/assets/showcase/
53
  !frontend/assets/showcase/*.webp
54
  !frontend/assets/showcase/*.png
55
  !frontend/assets/showcase/manifest.json
 
 
 
 
56
 
57
  vonfig.py
58
  lightloom-docs/
 
47
  frontend/.cache/
48
 
49
  # Showcase reel assets ARE part of the product: pre-rendered by the app's own
50
+ # endpoints (scripts/build_*.py), bundled so anon-quota visitors see the full
51
+ # experience instantly. Un-ignore them despite the blanket *.webp/*.png.
52
  !frontend/assets/showcase/
53
  !frontend/assets/showcase/*.webp
54
  !frontend/assets/showcase/*.png
55
  !frontend/assets/showcase/manifest.json
56
+ !frontend/assets/corridor/
57
+ !frontend/assets/corridor/*.webp
58
+ !frontend/assets/corridor/*.png
59
+ !frontend/assets/corridor/manifest.json
60
 
61
  vonfig.py
62
  lightloom-docs/
app.py CHANGED
@@ -144,7 +144,7 @@ def health() -> dict[str, Any]:
144
  "privacy_mode": os.getenv("LIGHTLOOM_PRIVACY_MODE", "1") == "1",
145
  "cpu_count": os.cpu_count(),
146
  "director_backend": CONFIG.director_backend,
147
- "build": "corridor-2",
148
  }
149
 
150
 
 
144
  "privacy_mode": os.getenv("LIGHTLOOM_PRIVACY_MODE", "1") == "1",
145
  "cpu_count": os.cpu_count(),
146
  "director_backend": CONFIG.director_backend,
147
+ "build": "corridor-3",
148
  }
149
 
150
 
frontend/assets/corridor/manifest.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "index": 0,
4
+ "caption": "An old lighthouse keeper counted the waves at the edge of the world.",
5
+ "image": "/frontend/assets/corridor/scene-0.webp",
6
+ "depth": "/frontend/assets/corridor/scene-0-depth.png"
7
+ },
8
+ {
9
+ "index": 1,
10
+ "caption": "Far away, a market woke under orange awnings and warm morning light.",
11
+ "image": "/frontend/assets/corridor/scene-1.webp",
12
+ "depth": "/frontend/assets/corridor/scene-1-depth.png"
13
+ },
14
+ {
15
+ "index": 2,
16
+ "caption": "A child ran through a garden of impossible glowing flowers.",
17
+ "image": "/frontend/assets/corridor/scene-2.webp",
18
+ "depth": "/frontend/assets/corridor/scene-2-depth.png"
19
+ },
20
+ {
21
+ "index": 3,
22
+ "caption": "A great whale drifted through a sunken city of coral and light.",
23
+ "image": "/frontend/assets/corridor/scene-3.webp",
24
+ "depth": "/frontend/assets/corridor/scene-3-depth.png"
25
+ },
26
+ {
27
+ "index": 4,
28
+ "caption": "Then snow buried the quiet road in silence.",
29
+ "image": "/frontend/assets/corridor/scene-4.webp",
30
+ "depth": "/frontend/assets/corridor/scene-4-depth.png"
31
+ }
32
+ ]
frontend/assets/corridor/scene-0-depth.png ADDED
frontend/assets/corridor/scene-0.webp ADDED

Git LFS Details

  • SHA256: 92d6bed6eb9103c3a5e8281253adca951eece3fccd04c953982af0b24634f422
  • Pointer size: 131 Bytes
  • Size of remote file: 138 kB
frontend/assets/corridor/scene-1-depth.png ADDED
frontend/assets/corridor/scene-1.webp ADDED

Git LFS Details

  • SHA256: 469aba7d48b8393ea93994311c90c5deb1d22347f7d72fdf61ceb3f31ca87e7a
  • Pointer size: 131 Bytes
  • Size of remote file: 131 kB
frontend/assets/corridor/scene-2-depth.png ADDED

Git LFS Details

  • SHA256: 8f527e7edb4b61fb26dd3c43fe7112b3c9d04e1434bd47d324de21c973fa5d83
  • Pointer size: 131 Bytes
  • Size of remote file: 137 kB
frontend/assets/corridor/scene-2.webp ADDED

Git LFS Details

  • SHA256: 4bad2bfece4f6fd862e9f4469eb2e2036b60e7966e4cda266fa69595ea104eea
  • Pointer size: 131 Bytes
  • Size of remote file: 168 kB
frontend/assets/corridor/scene-3-depth.png ADDED
frontend/assets/corridor/scene-3.webp ADDED

Git LFS Details

  • SHA256: 904d34354daef35138cbf101ae5dc2ad7519d387b1510f31c525d59c48c00e89
  • Pointer size: 131 Bytes
  • Size of remote file: 135 kB
frontend/assets/corridor/scene-4-depth.png ADDED
frontend/assets/corridor/scene-4.webp ADDED

Git LFS Details

  • SHA256: 5aa523ef5b6339a85fc5d9114bdd9e3c1c78394dd6f245292aee891f0f14c551
  • Pointer size: 131 Bytes
  • Size of remote file: 111 kB
scripts/build_corridor_showcase.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Pre-render the corridor Showcase: a vivid, diverse journey generated by the
2
+ SAME live /world endpoint, downloaded into frontend/assets/corridor/ with a
3
+ manifest. The frontend plays it back instantly (no GPU) so anon-quota judges see
4
+ the full immersive experience without waiting. Everything here is produced by the
5
+ deployed app itself. Run: HF_READ_TOKEN=... python scripts/build_corridor_showcase.py
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import json
11
+ import os
12
+ import time
13
+ import urllib.request
14
+ from pathlib import Path
15
+
16
+ from gradio_client import Client
17
+
18
+ ROOT = Path(__file__).resolve().parents[1]
19
+ OUT = ROOT / "frontend" / "assets" / "corridor"
20
+ SPACE_ID = os.getenv("LIGHTLOOM_DEV_SPACE_ID", "Efradeca/lightloom-dev")
21
+ BASE = os.getenv("SPACE_URL", "https://efradeca-lightloom-dev.hf.space")
22
+
23
+ # A vivid, diverse story that shows the range: sea, market, garden, coral city, snow.
24
+ STORY = (
25
+ "An old lighthouse keeper counted the waves at the edge of the world. "
26
+ "Far away, a market woke under orange awnings and warm morning light. "
27
+ "A child ran through a garden of impossible glowing flowers. "
28
+ "A great whale drifted through a sunken city of coral and light. "
29
+ "Then snow buried the quiet road in silence."
30
+ )
31
+
32
+
33
+ def _token() -> str:
34
+ tok = os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN")
35
+ if not tok:
36
+ raise SystemExit("HF_READ_TOKEN/HF_TOKEN required in env.")
37
+ return tok
38
+
39
+
40
+ def _dl(rel: str, dst: Path, token: str) -> int:
41
+ req = urllib.request.Request(BASE + rel, headers={"Authorization": "Bearer " + token})
42
+ data = urllib.request.urlopen(req, timeout=90).read()
43
+ dst.write_bytes(data)
44
+ return len(data)
45
+
46
+
47
+ def main() -> int:
48
+ token = _token()
49
+ OUT.mkdir(parents=True, exist_ok=True)
50
+ client = Client(SPACE_ID, token=token, verbose=False)
51
+ job = client.submit(STORY, "en", api_name="/world")
52
+ scenes: dict[int, dict] = {}
53
+ t0 = time.time()
54
+ for ev in job:
55
+ if not isinstance(ev, dict):
56
+ continue
57
+ st = ev.get("stage")
58
+ i = ev.get("index")
59
+ if st == "scene":
60
+ scenes.setdefault(i, {})["image"] = ev.get("image")
61
+ scenes[i]["caption"] = ev.get("caption", "")
62
+ print(f"[{time.time()-t0:5.1f}s] scene {i}")
63
+ elif st == "depth":
64
+ scenes.setdefault(i, {})["depth"] = ev.get("depth")
65
+ elif st in ("error", "quota_exceeded", "scene_error"):
66
+ print(f" !! {st}: {ev.get('error')}")
67
+ elif st == "done":
68
+ print(f"[{time.time()-t0:5.1f}s] done ({ev.get('count')} scenes)")
69
+
70
+ manifest = []
71
+ for i in sorted(scenes):
72
+ s = scenes[i]
73
+ if not s.get("image"):
74
+ continue
75
+ img_name = f"scene-{i}.webp"
76
+ depth_name = f"scene-{i}-depth.png"
77
+ n1 = _dl(s["image"], OUT / img_name, token)
78
+ n2 = _dl(s["depth"], OUT / depth_name, token) if s.get("depth") else 0
79
+ print(f" scene {i}: img={n1}B depth={n2}B {s.get('caption','')[:60]}")
80
+ manifest.append(
81
+ {
82
+ "index": i,
83
+ "caption": s.get("caption", ""),
84
+ "image": f"/frontend/assets/corridor/{img_name}",
85
+ "depth": f"/frontend/assets/corridor/{depth_name}" if s.get("depth") else None,
86
+ }
87
+ )
88
+ (OUT / "manifest.json").write_text(json.dumps(manifest, indent=2), encoding="utf-8")
89
+ print(f"WROTE manifest with {len(manifest)} scenes -> {OUT/'manifest.json'}")
90
+ return 0 if manifest else 1
91
+
92
+
93
+ if __name__ == "__main__":
94
+ raise SystemExit(main())
scripts/shoot-live.cjs CHANGED
@@ -1,27 +1,23 @@
1
- // Live end-to-end proof: drive the REAL deployed (private) Space in a real
2
- // browser via @gradio/client. Loads the Space with an HF Bearer header (private
3
- // access), fires a Roll, waits for the immersive world to stream in (~50s), and
4
- // screenshots it. This is the ultimate "not flying blind" check.
5
- // Usage: PANO_TOKEN=hf_xxx node scripts/shoot-live.cjs
6
  const { chromium } = require("playwright");
7
  const path = require("path");
8
  const fs = require("fs");
9
 
10
  const SPACE = process.env.SPACE_URL || "https://efradeca-lightloom-dev.hf.space";
11
  const TOKEN = process.env.PANO_TOKEN || "";
 
12
 
13
  (async () => {
14
  if (!TOKEN) { console.error("PANO_TOKEN env required"); process.exit(2); }
15
  const SHOTS = path.join(process.cwd(), ".shots");
16
  fs.mkdirSync(SHOTS, { recursive: true });
17
  const shot = (n) => path.join(SHOTS, n);
18
- const browser = await chromium.launch({
19
- args: ["--use-gl=angle", "--use-angle=swiftshader", "--ignore-gpu-blocklist", "--enable-webgl"],
20
- });
21
- const ctx = await browser.newContext({ viewport: { width: 1680, height: 820 } });
22
- // Inject the HF Bearer ONLY on Space-origin requests. Adding it globally would
23
- // poison the cross-origin @gradio/client CDN fetch (CORS rejects an Authorization
24
- // header it didn't allow), which is exactly what broke the first attempt.
25
  await ctx.route("**/*", (route) => {
26
  const url = route.request().url();
27
  if (url.startsWith(SPACE)) {
@@ -33,50 +29,36 @@ const TOKEN = process.env.PANO_TOKEN || "";
33
  const page = await ctx.newPage();
34
  const errs = [];
35
  page.on("console", (m) => { if (m.type() === "error") errs.push(m.text().slice(0, 200)); });
36
- page.on("pageerror", (e) => errs.push("PAGEERROR: " + e.message.slice(0, 200)));
37
 
38
  await page.goto(SPACE + "/", { waitUntil: "networkidle", timeout: 30000 }).catch((e) => errs.push("goto:" + e.message));
39
- await page.waitForTimeout(2000);
40
- await page.screenshot({ path: shot("live-lobby.png") });
41
 
42
- const MODE = process.env.MODE || "roll"; // "roll" (live GPU) | "showcase" (reel)
43
- // Fire the chosen flow through the real deployed app.
44
  const started = await page.evaluate((mode) => {
45
  const LL = window.LL;
46
  if (!LL || !LL.controller) return { ok: false, why: "no controller" };
47
- if (mode === "showcase") {
48
- const b = document.getElementById("btn-showcase");
49
- if (b) b.click(); else LL.controller.startShowcase();
50
- return { ok: true, mode };
51
- }
52
- const ta = document.getElementById("recital-text");
53
- if (ta) ta.value = "An old lighthouse keeper counted the waves at the edge of the world. Years later, the same road lay buried under snow and silence.";
54
- LL.controller.startRecital();
55
  return { ok: true, mode };
56
  }, MODE).catch((e) => ({ ok: false, why: String(e).slice(0, 160) }));
57
 
58
- // Wait up to ~90s for the world to reveal (Director + paint + depth).
59
- let revealed = false;
60
- for (let i = 0; i < 60; i++) {
61
- const st = await page.evaluate(() => ({
62
- worldShown: !!(window.LL && window.LL.controller && window.LL.controller._worldShown),
63
- stage: window.__lastStage || null,
64
- })).catch(() => ({}));
65
- if (st.worldShown) { revealed = true; break; }
66
- await page.waitForTimeout(2000);
 
67
  }
68
- await page.evaluate(() => window.dispatchEvent(new Event("resize")));
69
- await page.waitForTimeout(2200);
70
- await page.screenshot({ path: shot("live-world-1.png") });
71
- await page.waitForTimeout(2600);
72
- await page.screenshot({ path: shot("live-world-2.png") });
73
 
74
- const final = await page.evaluate(() => ({
75
- state: window.LL && window.LL.controller && window.LL.controller.state,
76
- worldShown: !!(window.LL && window.LL.controller && window.LL.controller._worldShown),
77
- activeScreen: [...document.querySelectorAll(".screen.is-active")].map((s) => s.id),
78
- }));
79
- console.log("STARTED:", JSON.stringify(started), "REVEALED:", revealed);
80
  console.log("FINAL:", JSON.stringify(final));
81
  console.log("JS_ERRORS:", JSON.stringify(errs.slice(0, 12)));
82
  await browser.close();
 
1
+ // Live end-to-end: drive the REAL deployed (private) Space — the immersive
2
+ // corridor — in a real browser via @gradio/client. Loads with an HF Bearer header
3
+ // (Space-origin only, so the @gradio/client CDN isn't CORS-poisoned), starts a
4
+ // world (text), waits for scenes to stream into the corridor, and screenshots it.
5
+ // Usage: PANO_TOKEN=hf_xxx [MODE=world|showcase] node scripts/shoot-live.cjs
6
  const { chromium } = require("playwright");
7
  const path = require("path");
8
  const fs = require("fs");
9
 
10
  const SPACE = process.env.SPACE_URL || "https://efradeca-lightloom-dev.hf.space";
11
  const TOKEN = process.env.PANO_TOKEN || "";
12
+ const MODE = process.env.MODE || "world";
13
 
14
  (async () => {
15
  if (!TOKEN) { console.error("PANO_TOKEN env required"); process.exit(2); }
16
  const SHOTS = path.join(process.cwd(), ".shots");
17
  fs.mkdirSync(SHOTS, { recursive: true });
18
  const shot = (n) => path.join(SHOTS, n);
19
+ const browser = await chromium.launch({ args: ["--use-gl=angle", "--use-angle=swiftshader", "--ignore-gpu-blocklist", "--enable-webgl"] });
20
+ const ctx = await browser.newContext({ viewport: { width: 1680, height: 900 } });
 
 
 
 
 
21
  await ctx.route("**/*", (route) => {
22
  const url = route.request().url();
23
  if (url.startsWith(SPACE)) {
 
29
  const page = await ctx.newPage();
30
  const errs = [];
31
  page.on("console", (m) => { if (m.type() === "error") errs.push(m.text().slice(0, 200)); });
32
+ page.on("pageerror", (e) => errs.push("PE:" + e.message.slice(0, 200)));
33
 
34
  await page.goto(SPACE + "/", { waitUntil: "networkidle", timeout: 30000 }).catch((e) => errs.push("goto:" + e.message));
35
+ await page.waitForTimeout(1800);
36
+ await page.screenshot({ path: shot("live-intro.png") });
37
 
 
 
38
  const started = await page.evaluate((mode) => {
39
  const LL = window.LL;
40
  if (!LL || !LL.controller) return { ok: false, why: "no controller" };
41
+ if (mode === "showcase") { LL.controller.playShowcase(); return { ok: true, mode }; }
42
+ LL.controller.startWorld("An old lighthouse keeper counted the waves at the edge of the world. Far away, a market woke under orange awnings and warm morning light. A child ran through a garden of impossible glowing flowers. Then snow buried the quiet road in silence.");
 
 
 
 
 
 
43
  return { ok: true, mode };
44
  }, MODE).catch((e) => ({ ok: false, why: String(e).slice(0, 160) }));
45
 
46
+ // Wait up to ~120s for the first scene (cold start loads models ~30s).
47
+ let scenes = 0;
48
+ for (let i = 0; i < 70; i++) {
49
+ const c = await page.evaluate(() => (window.LL.corridor && window.LL.corridor.count) || 0).catch(() => 0);
50
+ if (c > scenes) { scenes = c; }
51
+ if (scenes >= 1 && i > 4) {
52
+ await page.screenshot({ path: shot("live-world-" + Math.min(scenes, 4) + ".png") });
53
+ }
54
+ if (scenes >= 3) break;
55
+ await page.waitForTimeout(2500);
56
  }
57
+ await page.waitForTimeout(2500);
58
+ await page.screenshot({ path: shot("live-world-final.png") });
 
 
 
59
 
60
+ const final = await page.evaluate(() => ({ count: window.LL.corridor && window.LL.corridor.count, inWorld: document.body.classList.contains("in-world") }));
61
+ console.log("STARTED:", JSON.stringify(started), "SCENES_SEEN:", scenes);
 
 
 
 
62
  console.log("FINAL:", JSON.stringify(final));
63
  console.log("JS_ERRORS:", JSON.stringify(errs.slice(0, 12)));
64
  await browser.close();