| --- |
| title: NEMOCITY |
| emoji: ποΈ |
| colorFrom: red |
| colorTo: yellow |
| sdk: gradio |
| app_file: app.py |
| pinned: false |
| license: mit |
| short_description: Ask for a building, watch one tiny shared city rise |
| models: |
| - nvidia/NVIDIA-Nemotron-Nano-9B-v2 |
| datasets: |
| - AndresCarreon/nemocity-world |
| tags: |
| - build-small-hackathon |
| - track:wood |
| - sponsor:nvidia |
| - achievement:offbrand |
| - achievement:sharing |
| - achievement:fieldnotes |
| - thousand-token-wood |
| - nemotron |
| - nvidia |
| - simulation |
| - city-builder |
| - world-building |
| - three-js |
| - multiplayer |
| --- |
| |
| <!-- ^ Space card config. app.py runs as a Gradio Server (gr.Server): it serves |
| the WebGL city at /, the JSON/SSE API under /api, and the gradio endpoint |
| that runs the granting call under /gradio_api. sdk_version 6.16.0 is the |
| pre-SSR gradio proven live on the org ZeroGPU (pareidolia) with this exact |
| launch pattern; pairs with transformers <5 (nemotron_h in-tree from 4.55.4). --> |
| |
| # NEMOCITY |
|
|
| **Ask for a building and watch it rise β one tiny persistent city the whole |
| internet builds, with a 9B Nemotron running city hall.** |
|
|
| Type a petition β *"a ramen shop near the park"* β and a small NVIDIA Nemotron |
| reads it at city hall, the deterministic engine zones a lot, and you (and every |
| other visitor on Earth) watch it rise floor by floor in ONE shared miniature |
| city. There is no level select and no reset button: your cafe stands next to a |
| stranger's fire station, forever, on the same 64x64 grid. |
|
|
| The city is alive between petitions. Cars commute on a shared deterministic |
| clock, rush hour jams the Old Bridge twice a day, windows light at dusk, and a |
| news ticker reads the model's blurbs as headlines. Press Walk and you are on the |
| sidewalk in first person, at street level, under the buildings the internet |
| asked for. |
|
|
| The whole city renders client-side from an append-only event log β judges see a |
| gorgeous living diorama with zero GPU spend. The GPU wakes exactly once per |
| action, for one one-shot JSON generation. |
|
|
| ## How city hall works (the "her" pattern) |
|
|
| The deterministic engine owns ALL facts: city state, placement, geometry, road |
| routing, traffic telemetry. [NVIDIA-Nemotron-Nano-9B-v2](https://huggingface.co/nvidia/NVIDIA-Nemotron-Nano-9B-v2) |
| never outputs a coordinate β it translates your petition into one tiny JSON |
| permit (kinds, names, a fuzzy "near" hint) and narrates. The engine resolves, |
| clamps, and repairs everything, so a visitor action ALWAYS yields visible |
| construction. The model's raw JSON is shown in the UI on every action (the |
| "City Hall paperwork" drawer). |
|
|
| ``` |
| your petition ("a ramen shop near the park") |
| | |
| v |
| +- CITY HALL - Nemotron-Nano-9B-v2 (ONE one-shot call) -----+ |
| | {"intent":"build","blurb":"...", | |
| | "buildings":[{"kind":"cafe","name":"Ramen Ichi", | |
| | "near":"the park"}]} | |
| | no coordinates, ever - kinds + names + fuzzy hints only | |
| +------------------------------+----------------------------+ |
| | permit JSON |
| v |
| +- THE ENGINE - deterministic Python -----------------------+ |
| | synonym-repairs kinds -> scores placement -> clamps | |
| | floors -> routes connector roads -> seeds + appends | |
| | events; owns ALL state, the model owns none of it | |
| +------------------------------+----------------------------+ |
| | world_delta (SSE broadcast) |
| v |
| +- THE CITY - Three.js, client-side, zero GPU ---------------+ |
| | pure function of (event list, shared simTime): | |
| | buildings rise floor by floor, cars commute, jams form | |
| +------------------------------------------------------------+ |
| ``` |
|
|
| ## The traffic fix (ask the City Engineer) |
|
|
| Rush hour is real, simulated telemetry β not theater. When a road segment stays |
| jammed, a traffic alert appears with one button: **Ask the City Engineer**. The |
| engine snapshots the facts (worst cells by demand/capacity with street names, |
| the Traffic Index) and pre-validates candidate fixes with predicted outcomes by |
| re-running its static traffic assignment. Nemotron gets `{stats, candidates}` |
| and answers with a diagnosis citing the real numbers plus a choice β *"Old |
| Bridge carries 3.1x capacity at rush β a second crossing cuts the index |
| 78 to 41."* The engine lays the new road, every client's cars re-route live, and |
| the red drains green while you watch. Facts from the engine, judgment from the |
| model β small models doing what small models are great at. |
|
|
| ## Built for Build Small β Thousand Token Wood |
|
|
| - One model, 9B params, in-process on ZeroGPU β comfortably under the 32B cap. |
| - **Off-Brand** β fully custom WebGL frontend on `gr.Server`; gradio powers the |
| API endpoints, not the visible UI. |
| - **Sharing is Caring** β every petition's full trace (text, moderation verdict, |
| raw model JSON, resulting events) appends live to a public dataset: |
| [AndresCarreon/nemocity-world](https://huggingface.co/datasets/AndresCarreon/nemocity-world). |
| The dataset also makes the city persistent across Space restarts. |
| - **Field Notes** β build log shipping with the submission. |
|
|
| ## Submission links |
|
|
| - **Demo video:** [βΆ Watch the demo](https://youtu.be/7NJ4Hv0byVo) |
| - **Social post:** [On X / Twitter](https://x.com/_Andresio/status/2066367676662882721) |
| - **Trace dataset:** [AndresCarreon/nemocity-world](https://huggingface.co/datasets/AndresCarreon/nemocity-world) |
|
|
| ## Run it locally |
|
|
| ```bash |
| uv venv -p 3.12 .venv && uv pip install -r requirements.txt |
| CITY_BACKEND=mock PORT=7900 .venv/bin/python app.py # open http://localhost:7900 |
| ``` |
|
|
| Renderer alone (no backend): `python3 -m http.server 8123 --directory web` and |
| open `http://localhost:8123/?mock=1`. |
|
|
| Env: `CITY_BACKEND` (`mock | zerogpu`), `CITY_DATASET` + `HF_TOKEN` (trace |
| publishing and persistence across restarts), `CITY_SECRET` (stable visitor |
| identity), `CITY_JUDGE` (optional LLM moderation layer), `CITY_INVOKE` |
| (`browser | server` GPU invocation), `CITY_MOCK_DELAY`, `CITY_HF_MODEL`, `PORT`. |
|
|
| ## Credits |
|
|
| - **LLM:** NVIDIA Nemotron Nano 9B v2 (open weights), via transformers on ZeroGPU. |
| - **Rendering:** [three.js](https://threejs.org) (MIT), vendored. |
|
|
| *Ask, and the city builds.* |
|
|