Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(model-triposr): composite background-removed image to RGB before inference
fudjia0b8ab9f4fb70
diff --git a/workers/model-triposr/main.py b/workers/model-triposr/main.pyindex b045b20e9..de6e35284 100644--- a/workers/model-triposr/main.py+++ b/workers/model-triposr/main.py@@ -125,9 +125,18 @@ def _remove_background(img: Image.Image) -> Image.Image:buf = io.BytesIO()img.save(buf, format="PNG")out = rembg.remove(buf.getvalue())- return Image.open(io.BytesIO(out)).convert("RGBA")+ rgba = Image.open(io.BytesIO(out)).convert("RGBA")except Exception:- return img.convert("RGBA")+ rgba = img.convert("RGBA")+ # TripoSR's tokenizer normalizes with a 3-channel mean/std (see+ # tsr/models/tokenizers/image.py) and errors on a 4-channel RGBA tensor+ # ("size of tensor a (4) must match ... b (3)"). The upstream TripoSR demo+ # (run.py) matting step fills the removed background with mid-gray (127)+ # before flattening to RGB — do the same instead of shipping RGBA straight+ # into the model.+ background = Image.new("RGB", rgba.size, (127, 127, 127))+ background.paste(rgba, mask=rgba.split()[3])+ return backgroundasync def _run_inference(task_id: str, images: list[str], body_type: str) -> None: