samuel4038's picture
Add optional Hugging Face sign-in for personal ZeroGPU quota
72b82b2 verified
|
Raw History Blame Contribute Delete
4.3 kB
---
title: SAM 3D Objects Studio
emoji: 🧊
colorFrom: green
colorTo: blue
sdk: static
app_file: index.html
short_description: Select an object in a photo and reconstruct it in 3D
models:
- facebook/sam-3d-objects
- facebook/sam3
tags:
- image-to-3d
- 3d-modeling
- sam3d
- static
license: mit
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
---
# SAM 3D Objects Studio
A free, browser-based demo for Meta's **SAM 3D Objects**: upload a photo, name
one object, and inspect/download the reconstructed vertex-colored GLB mesh.
## Architecture and limits
This is a **static frontend, not a standalone model deployment**. Live inference
uses the public [HaiderCG/sam3d-lab](https://huggingface.co/spaces/HaiderCG/sam3d-lab)
Gradio API, running **SAM 3 segmentation → SAM 3D Objects reconstruction**.
The frontend uses the official `@gradio/client` queue protocol and
`@google/model-viewer` for interactive GLB rendering.
- **No paid hardware**, API key, or embedded token is required by this frontend.
- Optional **Sign in with Hugging Face** uses the official OAuth flow (profile only, no repository write access). The short-lived token stays in this browser tab's session storage and is used only to authenticate requests to Hugging Face / the named Gradio backend. It is never bundled or sent to this static Space as a stored secret. Sign out clears it.
- Shared backend availability and Hugging Face ZeroGPU quotas apply. Requests can
queue or fail when capacity/quota is exhausted. No automatic backend switching.
- Uploaded images and prompts go directly to the named third-party backend.
**Do not upload confidential or personal images.** This frontend has no analytics
and does not persist uploads. The backend's own data policies still apply.
- Generation reconstructs the highest-scoring matching instance, not every object.
Use short English object names such as `bus`, `chair`, or `coffee mug`.
- Backend seed is 42. Mesh postprocessing, texture baking, and layout
postprocessing are disabled upstream; the output uses vertex colors rather
than a baked texture map. Hidden surfaces are model estimates, not measurements.
- The bus example's saved GLB is an actual SAM 3D Objects API result, clearly
labeled as a saved example. It remains inspectable without consuming GPU quota.
## Using the demo
1. Choose a PNG, JPEG, or WebP image (up to 20 MB / 20 megapixels), or load the bus example.
2. Name the object to reconstruct.
3. Select **Generate 3D**. A cold request can take a few minutes plus queue time.
4. Drag to orbit, scroll/pinch to zoom, and download the GLB or mask preview.
The **Saved result** button shows the bundled, verified bus reconstruction;
**Generate 3D** always sends a new inference request (it does not serve the cache).
Cancellation stops listening and cancels queued work where supported; work that
already started may continue on the shared GPU.
## Build / develop
The Space serves a prebuilt release. Download `source-code.zip` from the Files
tab for the complete editable Vite project. Extract it before the commands below.
Node.js 22.12+ (Node 24 recommended):
```bash
npm ci
npm test
npm run build
npm run dev
```
Run `npm run build`, then upload the contents of `dist/` to this repository's root, retaining this README. The Space serves `index.html` without paid build/runtime hardware.
Do not put access tokens in JavaScript, static Space variables, or this repository.
## Credits and licenses
- Model: [facebook/sam-3d-objects](https://huggingface.co/facebook/sam-3d-objects),
[Meta source](https://github.com/facebookresearch/sam-3d-objects), **SAM License**.
- Segmentation: [facebook/sam3](https://huggingface.co/facebook/sam3); its own license applies.
- Public inference: [HaiderCG/sam3d-lab](https://huggingface.co/spaces/HaiderCG/sam3d-lab).
- Bus test image: [Gradio repository test fixture](https://github.com/gradio-app/gradio/blob/main/test/test_files/bus.png).
- Application source is MIT licensed. This does **not** relicense model weights,
the example image, or generated outputs. Review the upstream model terms for use.
An independent community demo; not an official Meta application.