--- 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.