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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<meta name="theme-color" content="#111218" />
|
| 7 |
+
<meta
|
| 8 |
+
name="description"
|
| 9 |
+
content="Run Stable Fast 3D locally in your browser with WebGPU."
|
| 10 |
+
/>
|
| 11 |
+
<title>Stable Fast 3D · WebGPU</title>
|
| 12 |
+
<link rel="preconnect" href="https://huggingface.co" />
|
| 13 |
+
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
|
| 14 |
+
<link rel="stylesheet" href="./styles.css" />
|
| 15 |
+
<script type="importmap">
|
| 16 |
+
{
|
| 17 |
+
"imports": {
|
| 18 |
+
"three": "https://cdn.jsdelivr.net/npm/three@0.179.1/build/three.module.js",
|
| 19 |
+
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.179.1/examples/jsm/"
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
</script>
|
| 23 |
+
</head>
|
| 24 |
+
<body>
|
| 25 |
+
<div class="page-shell">
|
| 26 |
+
<header class="topbar">
|
| 27 |
+
<a class="brand" href="https://huggingface.co/" target="_blank" rel="noreferrer">
|
| 28 |
+
<span class="brand-mark">hf</span>
|
| 29 |
+
<span>Hugging Face · Static Space</span>
|
| 30 |
+
</a>
|
| 31 |
+
<div class="topbar-meta">
|
| 32 |
+
<span class="status-dot" id="webgpu-dot"></span>
|
| 33 |
+
<span id="webgpu-label">Checking WebGPU…</span>
|
| 34 |
+
</div>
|
| 35 |
+
</header>
|
| 36 |
+
|
| 37 |
+
<main>
|
| 38 |
+
<section class="hero">
|
| 39 |
+
<div class="eyebrow"><span></span> STABLE FAST 3D / BROWSER LAB</div>
|
| 40 |
+
<h1>One image.<br /><em>One mesh.</em></h1>
|
| 41 |
+
<p class="hero-copy">
|
| 42 |
+
Reconstruct a clean, orbit-ready 3D asset from a single image —
|
| 43 |
+
locally, privately, and accelerated by your GPU.
|
| 44 |
+
</p>
|
| 45 |
+
<div class="hero-links">
|
| 46 |
+
<a href="https://huggingface.co/stabilityai/stable-fast-3d" target="_blank" rel="noreferrer">Original model ↗</a>
|
| 47 |
+
<a href="https://huggingface.co/needle-tools/SF3D-webgpu" target="_blank" rel="noreferrer">Browser export ↗</a>
|
| 48 |
+
</div>
|
| 49 |
+
</section>
|
| 50 |
+
|
| 51 |
+
<section class="workspace-grid">
|
| 52 |
+
<aside class="control-card card">
|
| 53 |
+
<div class="card-heading">
|
| 54 |
+
<div>
|
| 55 |
+
<span class="section-kicker">01 / INPUT</span>
|
| 56 |
+
<h2>Choose an image</h2>
|
| 57 |
+
</div>
|
| 58 |
+
<span class="mini-badge">512 × 512</span>
|
| 59 |
+
</div>
|
| 60 |
+
|
| 61 |
+
<label class="dropzone" id="dropzone" for="image-file">
|
| 62 |
+
<input id="image-file" type="file" accept="image/png,image/jpeg,image/webp" />
|
| 63 |
+
<div class="upload-icon">↑</div>
|
| 64 |
+
<strong>Drop an object image here</strong>
|
| 65 |
+
<span>PNG with transparency works best</span>
|
| 66 |
+
<span class="browse-link">Browse files</span>
|
| 67 |
+
</label>
|
| 68 |
+
|
| 69 |
+
<div class="preview-wrap is-hidden" id="preview-wrap">
|
| 70 |
+
<img id="input-preview" alt="Selected input" />
|
| 71 |
+
<div class="preview-label"><span id="preview-name">Input image</span><span id="preview-size"></span></div>
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
<button class="sample-button" id="sample-button" type="button">
|
| 75 |
+
<span>Try a sample</span><span class="sample-arrow">↗</span>
|
| 76 |
+
</button>
|
| 77 |
+
|
| 78 |
+
<label class="toggle-row">
|
| 79 |
+
<span class="toggle-copy">
|
| 80 |
+
<strong>Clean the background</strong>
|
| 81 |
+
<small>Transformers.js · WebGPU</small>
|
| 82 |
+
</span>
|
| 83 |
+
<input id="remove-background" type="checkbox" checked />
|
| 84 |
+
<span class="toggle-ui"></span>
|
| 85 |
+
</label>
|
| 86 |
+
|
| 87 |
+
<div class="tip-box">
|
| 88 |
+
<span class="tip-icon">✦</span>
|
| 89 |
+
<span>Use one centered object with good contrast. Transparent PNGs skip the cleanup model.</span>
|
| 90 |
+
</div>
|
| 91 |
+
|
| 92 |
+
<button class="primary-button" id="generate-button" type="button" disabled>
|
| 93 |
+
<span id="generate-label">Select an image</span>
|
| 94 |
+
<span class="button-arrow">→</span>
|
| 95 |
+
</button>
|
| 96 |
+
</aside>
|
| 97 |
+
|
| 98 |
+
<section class="viewer-card card">
|
| 99 |
+
<div class="viewer-head">
|
| 100 |
+
<div>
|
| 101 |
+
<span class="section-kicker">02 / OUTPUT</span>
|
| 102 |
+
<h2>Inspect your mesh</h2>
|
| 103 |
+
</div>
|
| 104 |
+
<span class="live-badge"><i></i> LOCAL INFERENCE</span>
|
| 105 |
+
</div>
|
| 106 |
+
<div class="viewer-stage" id="viewer-stage">
|
| 107 |
+
<canvas id="viewer-canvas" aria-label="3D mesh viewer"></canvas>
|
| 108 |
+
<div class="viewer-empty" id="viewer-empty">
|
| 109 |
+
<div class="empty-orbit">◎</div>
|
| 110 |
+
<strong>Your mesh will appear here</strong>
|
| 111 |
+
<span>Drag to orbit · scroll to zoom</span>
|
| 112 |
+
</div>
|
| 113 |
+
<div class="viewer-progress is-hidden" id="viewer-progress">
|
| 114 |
+
<div class="progress-ring"><span id="progress-percent">0%</span></div>
|
| 115 |
+
<strong id="progress-title">Preparing pipeline</strong>
|
| 116 |
+
<span id="progress-detail">The first run downloads the model into your browser cache.</span>
|
| 117 |
+
</div>
|
| 118 |
+
<div class="viewer-error is-hidden" id="viewer-error">
|
| 119 |
+
<div class="error-icon">!</div>
|
| 120 |
+
<strong id="error-title">Something went wrong</strong>
|
| 121 |
+
<span id="error-detail"></span>
|
| 122 |
+
<button id="error-dismiss" type="button">Dismiss</button>
|
| 123 |
+
</div>
|
| 124 |
+
<div class="viewer-toolbar">
|
| 125 |
+
<button id="reset-view" type="button" title="Reset camera">Reset view</button>
|
| 126 |
+
<span id="mesh-stats">No mesh loaded</span>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
<div class="viewer-foot">
|
| 130 |
+
<div class="metric"><span>RUNTIME</span><strong id="runtime-metric">—</strong></div>
|
| 131 |
+
<div class="metric"><span>VERTICES</span><strong id="vertices-metric">—</strong></div>
|
| 132 |
+
<div class="metric"><span>FACES</span><strong id="faces-metric">—</strong></div>
|
| 133 |
+
<button class="download-button" id="download-button" type="button" disabled>
|
| 134 |
+
Download GLB <span>↓</span>
|
| 135 |
+
</button>
|
| 136 |
+
</div>
|
| 137 |
+
</section>
|
| 138 |
+
</section>
|
| 139 |
+
|
| 140 |
+
<section class="how-section">
|
| 141 |
+
<div class="section-heading-row">
|
| 142 |
+
<div>
|
| 143 |
+
<span class="section-kicker">03 / UNDER THE HOOD</span>
|
| 144 |
+
<h2>Private by design</h2>
|
| 145 |
+
</div>
|
| 146 |
+
<p>No image leaves this tab. Models are fetched once, then cached by your browser.</p>
|
| 147 |
+
</div>
|
| 148 |
+
<div class="steps-grid">
|
| 149 |
+
<article class="step-card">
|
| 150 |
+
<span class="step-number">01</span>
|
| 151 |
+
<div class="step-icon">◌</div>
|
| 152 |
+
<h3>Prepare</h3>
|
| 153 |
+
<p>Optional foreground cleanup runs with Transformers.js on WebGPU.</p>
|
| 154 |
+
</article>
|
| 155 |
+
<article class="step-card step-accent">
|
| 156 |
+
<span class="step-number">02</span>
|
| 157 |
+
<div class="step-icon">⌁</div>
|
| 158 |
+
<h3>Reconstruct</h3>
|
| 159 |
+
<p>SF3D’s ONNX graphs predict a triplane and decode its surface locally.</p>
|
| 160 |
+
</article>
|
| 161 |
+
<article class="step-card">
|
| 162 |
+
<span class="step-number">03</span>
|
| 163 |
+
<div class="step-icon">◇</div>
|
| 164 |
+
<h3>Explore</h3>
|
| 165 |
+
<p>Orbit the mesh, inspect its topology, and export a portable GLB.</p>
|
| 166 |
+
</article>
|
| 167 |
+
</div>
|
| 168 |
+
</section>
|
| 169 |
+
</main>
|
| 170 |
+
|
| 171 |
+
<footer class="footer">
|
| 172 |
+
<span>Powered by Stability AI · Stable Fast 3D Community License</span>
|
| 173 |
+
<span>WebGPU / Transformers.js / ONNX Runtime Web</span>
|
| 174 |
+
</footer>
|
| 175 |
+
</div>
|
| 176 |
+
|
| 177 |
+
<script type="module" src="./src/main.js"></script>
|
| 178 |
+
</body>
|
| 179 |
</html>
|