Porting the Moebius 0.2B image inpainting model to run in the browser with Claude Code
Simon Willison’s Weblog
Subscribe
Sponsored by: Microsoft — Agent projects stall between demo and production. Microsoft's MVP checklist closes that gap. Try it
Porting the Moebius 0.2B image inpainting model to run in the browser with Claude Code
22nd June 2026
This morning on Hacker News I saw Moebius: 0.2B Lightweight Image Inpainting Framework with 10B-Level Performance, describing a small but effective inpainting model—a model where you can mark regions of an image to remove and the model imagines what should fill the space. The released model required PyTorch and NVIDIA CUDA, but since it described itself as 0.2B I decided to try and get it running using WebGPU in a browser. TL;DR: I got it working, and you can try the demo at simonw.github.io/moebius-web/. Read on for the details.
The finished tool
Here’s a video demo of the finished tool:
You can open any image in it (non-square images get letterboxed), highlight areas to remove, click the “Run inpaint” button and wait for the model to do its magic.
A parallel agent side-project
My main project for today was landing a major feature in Datasette: a UI for creating and altering tables, as a follow-up to the insert and edit rows feature I released last week.
I was working on that in Codex Desktop (here’s the PR) and often found myself spending 5-10 minutes spinning my fingers waiting for it to complete a mid-sized refactor or add the finishing touches to a change to the UI.
(An amusing thing about coding agents is that the harder a problem is the more time you have to get distracted while you wait for them to finish crunching!)
So I decided to spin up Claude Code in a terminal window and see how far I could get at porting Moebius to the web.
Some agentic research to kick off the project
My first step was to ask regular Claude about the feasibility of this project. In Claude.ai, which has the ability to clone repos from GitHub:
Clone [https://github.com/hustvl/Moebius/](https://github.com/hustvl/Moebius/) and tell me if they published the code and weights to run this model anywhere
(I hadn’t spotted the link to the weights yet, that’s tucked away in the “News” section.)
Then:
For Moebius what are the options for running it right now - Python and NVIDIA CUDA only or other options too?
And:
Muse on the feasibility of porting it to Transformers.js or similar and running it in a browser
I like telling models to “muse on X”, it’s the shortest way I’ve found of expressing that I want them to contemplate a problem for me without providing them with a concrete goal.
Here’s that chat transcript. I copied out the last answer and saved it as research.md for Claude Code to read later.
Claude suggested using ONNX Runtime Web on the WebGPU backend —the layer below the Transformers.js library I had suggested.
That was enough to convince me it was worth setting Claude Code loose and seeing how far it could get.
I usually start projects like this by gathering as much information as the coding agent might need as possible. Since I didn’t expect this project to actually work I did everything in my /tmp folder:
cd /tmp<br>mkdir Moebius<br>cd Moebius<br># Grab the Moebius python code<br>git clone https://github.com/hustvl/Moebius<br># And the model weights (Claude figured this out):<br>GIT_LFS_SKIP_SMUDGE=0 git clone \<br>https://huggingface.co/hustvl/Moebius Moebius-weights<br># Finally a couple of libraries we might use:<br>git clone https://github.com/huggingface/transformers.js<br>git clone https://github.com/microsoft/onnxruntime
Setting off Claude Code
I created a directory for the rest of the project and ran git init in that so Claude could start committing code notes:
mkdir /tmp/Moebius/moebius-web<br>cd /tmp/Moebius/moebius-web<br>git init<br># Copy in that research.md from earlier<br>git add research.md<br>git commit -m "Initial research by Claude Opus 4.8"
I fired up a claude instance in the /tmp/Moebius folder, the level above all of the research materials I had prepared for it. I prompted:
Read ./moebius-web/research.md - your goal is to port this model to ONNX and WebGPU so we can run it directly in a browser, with a simple UI
As it started to work I dropped in this follow-up (typos included):
Bulid this in /tmp/Moebius/moebius-web and commit early and often, also maintain a notes.md file in there with notes about what you figure out along the way - also start by writing out a plan.md in there and update that plan as oy work too
I often ask agents to keep notes like this—the end result is often interesting, both for myself and for the next agent session that touches the same project. Here’s what that notes.md file looked like at the end of the project.
I kicked it off and went back to my main project, checking in occasionally to see how Claude was doing. When it looked like it might have something that worked I prompted:
Tell me what URL I can visit in my own browser to try...