merve's picture
merve HF Staff
Add Gemma Diffusion 3D asset builder with google/diffusiongemma-26B-A4B-it
7f3234f verified

A newer version of the Gradio SDK is available: 6.18.0

Upgrade
metadata
title: Gemma Diffusion 3D Asset Builder
emoji: 🧊
colorFrom: indigo
colorTo: purple
sdk: gradio
sdk_version: 6.17.3
python_version: '3.12'
app_file: app.py
pinned: false
short_description: Diffuse an SVG game asset and watch it extrude into live 3D

Gemma Diffusion Β· Text β†’ 3D Asset

A live, side-by-side visualization of block-diffusion generation. Describe a game asset (a sword, potion, treasure chest, spaceship, ...) and the model designs an original SVG illustration by denoising a canvas of random tokens β€” every position updates at once each step. A fixed, hand-written Three.js harness then extrudes that SVG into an interactive, spinning 3D object.

The left pane shows the raw SVG canvas diffusing token-by-token (the signature look of text diffusion); the right pane shows the extruded 3D scene (drag to orbit). Type a follow-up to tweak in place: the previous artwork seeds the diffusion's starting canvas (via the model's native canvas_ids API), so the model edits the existing asset instead of regenerating from scratch.

Stack

  • Model: google/diffusiongemma-26B-A4B-it (DiffusionGemmaForBlockDiffusion).
  • Backend: gradio.Server β€” a FastAPI subclass that provides Gradio's queue + SSE streaming under a custom, hand-written HTML/CSS/JS frontend (index.html). The single streaming endpoint /generate yields one JSON frame per denoising step. The model only has to produce the SVG art; the frontend owns the (reliable) 3D extrusion, so the scene always renders.
  • Hardware: ZeroGPU (xlarge) β€” the 26B checkpoint needs the full backing card.

A custom transformers wheel providing the DiffusionGemma architecture is bundled in this repo and installed at runtime by app.py (Spaces installs requirements.txt before the repo files are copied in, so a local-path wheel can't be referenced there).

Configuration

  • HF_TOKEN (secret) β€” read access to the private model repo.
  • GRADIO_SSR_MODE=false (variable) β€” required so the custom / route serves index.html instead of Gradio's SSR shell.
  • GDIFF_MODEL_PATH (optional) β€” override the model repo id.
  • GDIFF_GPU_SIZE (optional) β€” ZeroGPU slice, defaults to xlarge.