File size: 2,418 Bytes
36dd915
298e043
 
 
 
36dd915
298e043
 
36dd915
298e043
 
 
 
 
 
 
 
 
 
36dd915
 
298e043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: Scene Machine 9
emoji: 🖥️
colorFrom: gray
colorTo: blue
sdk: gradio
sdk_version: 6.10.0
python_version: 3.11
app_file: app.py
short_description: Turn text prompts into procedural Three.js scenes.
startup_duration_timeout: 10m
models:
  - deepseek-ai/DeepSeek-V4-Flash-0731
tags:
  - threejs
  - text-to-3d
  - procedural-generation
  - inference-providers
license: mit
---

# Scene Machine 9

Scene Machine 9 turns a text description into a procedural Three.js scene. It uses
[DeepSeek V4 Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731) through
Hugging Face Inference Providers, validates the returned JSON against a small scene
contract, and renders only whitelisted primitives inside a sandboxed iframe.

## Design

The pipeline adapts the central idea from
[img2threejs](https://github.com/img2threejs/img2threejs): build recognizable 3D objects
from code, named parts, procedural geometry, and explicit materials instead of producing
an opaque mesh. The original project is an agent skill for image-guided, multi-pass
reconstruction. This Space is intentionally text-driven and completes a smaller pipeline
in one request:

1. silently inventory identity-defining details;
2. plan blockout, structure, form, materials, and surface details;
3. emit a constrained JSON scene;
4. normalize ranges and reject unsafe fields server-side;
5. render the result with Three.js in the browser.

Generated JavaScript is never evaluated. The renderer accepts seven primitive families,
transforms, colors, and bounded PBR material values only.

## Configuration

The Space requires an `HF_TOKEN` secret with Inference Providers access. No token is sent
to the browser or included in API responses.

## API

The public Gradio endpoint is `/generate` and accepts:

- `prompt`: object or small-scene description;
- `detail`: one of the three geometry budgets shown in the UI;
- `finish`: one of the art-direction presets shown in the UI.

It returns an interactive preview document, the normalized JSON scene, and a short status.

## Model choice

DeepSeek V4 Flash 0731 was selected after checking Hugging Face's live inference catalog.
It is available through several routed providers and is particularly strong on current
code-agent and full-stack evaluations, which closely match this structured code-generation
task. See [RESEARCH.md](RESEARCH.md) for the implementation notes and tradeoffs.