Code4Scene / scripts /harbor_card.py
KoeYe's picture
Claude Opus 5.5
Feature GPT-6 Astra's Industrial Harbor in the Text-to-Scene cases
c3746b4
Raw History Blame Contribute Delete
4 kB
"""Feature GPT-6 Astra's Industrial Harbor in the Text-to-Scene cases (user, 2026-10-04: "你把harbor的case也放在这个code4scene里").
The scene is the one SimWorld-AI/industrial-harbor-viewer serves (scene industrial-harbor-astra-max, 3,949 actors). Its ~1.2 GB
texture library is too large for this Space's model cards, so the card shows a still from that viewer and links to it.
media/t2s/industrial-harbor/astra.jpg is a headless-Chrome capture of the viewer's preview textures, UI hidden.
The task is SceneBench's text-to-scene/industrial-harbor.yaml; it is not one of the 20 Research Track scenes, so no score.
Each step asserts it found what it edits.
python3 scripts/harbor_card.py
"""
from __future__ import annotations
import re
from pathlib import Path
from bs4 import BeautifulSoup
ROOT = Path(__file__).resolve().parent.parent
V = "20261004harbor"
VIEWER = "https://simworld-ai-industrial-harbor-viewer.static.hf.space/"
PROMPT = ("An industrial harbor loading dock with shipping containers, barrels, cranes, warehouse props, pallets, "
"and warning signs.")
def one(found, what):
assert found, f"not found: {what}"
return found
CARD = f"""<article class="case-card case-feature">
<a class="feature-shot" href="{VIEWER}" target="_blank" rel="noopener" aria-label="Open GPT-6 Astra's Industrial Harbor in the interactive 3D viewer">
<img src="media/t2s/industrial-harbor/astra.jpg?v={V}" alt="GPT-6 Astra's Industrial Harbor: quay cranes over a container ship, container stacks, a hangar, storage tanks and a rail siding" loading="lazy" width="1600" height="900"/>
<span class="feature-badge">3,949 actors</span>
</a>
<div class="meta">
<span class="eyebrow">Text-to-Scene · Showcase</span>
<h4>Industrial Harbor</h4>
<p>GPT-6 Astra (max) · one agent session in Unreal Engine, from an empty 130 m stage</p>
<blockquote class="feature-prompt">{PROMPT}</blockquote>
<a class="text-button" href="{VIEWER}" target="_blank" rel="noopener">Explore the full scene in 3D ↗</a>
<p class="feature-note">Streams about 1.2 GB of textures on first load.</p>
</div>
</article>"""
CSS = """
/* featured showcase card (scripts/harbor_card.py) */
.case-grid .case-feature{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr)}
.case-feature .feature-shot{position:relative;display:block;background:#8ec6ec;aspect-ratio:16/9;overflow:hidden}
.case-feature .feature-shot img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .4s}
.case-feature .feature-shot:hover img{transform:scale(1.025)}
.case-feature .feature-badge{position:absolute;left:12px;bottom:12px;padding:5px 10px;border-radius:6px;background:#17201dcc;color:#fff;font:500 12px 'IBM Plex Mono',monospace}
.case-feature .meta{display:flex;flex-direction:column;justify-content:center}
.case-feature .feature-prompt{margin:12px 0 14px;padding:10px 14px;border-left:3px solid var(--border);color:var(--text-muted);font-size:13px;line-height:1.6;font-style:italic}
.case-feature .feature-note{margin-top:6px;font-size:11px;color:var(--text-muted)}
@media(max-width:900px){.case-grid .case-feature{grid-template-columns:minmax(0,1fr)}}
"""
def index():
p = ROOT / "index.html"
soup = BeautifulSoup(p.read_text(), "html.parser")
assert not soup.find(class_="case-feature"), "already featured"
grid = one(soup.find(id="cases").find(class_="case-grid", attrs={"data-view": "t2s"}), "Text-to-Scene case grid")
grid.insert(0, BeautifulSoup(CARD, "html.parser"))
for t in soup.find_all("link", href=re.compile(r"^assets/buildingbench\.css")):
t["href"] = f"assets/buildingbench.css?v={V}"
p.write_text(str(soup))
print("index.html: Industrial Harbor card")
def css():
p = ROOT / "assets/buildingbench.css"; s = p.read_text()
assert "scripts/harbor_card.py" not in s
p.write_text(s.rstrip("\n") + "\n" + CSS)
print("buildingbench.css: feature card rules")
if __name__ == "__main__":
index(); css()