--- title: Brad Did Something emoji: ๐Ÿš€ colorFrom: pink colorTo: yellow sdk: docker app_port: 7860 pinned: false license: mit short_description: Argue your way to $1M before the quarter ends tags: - track:wood - sponsor:modal - achievement:offbrand - achievement:llama - achievement:fieldnotes --- # ๐Ÿš€ Brad Did Something ![Brad Did Something](docs/media/cover.gif) > *Corporate bureaucracy is already a chaotic simulation โ€” I just replaced middle management with an LLM to see if the company could survive the quarter.* A 2D top-down **office comedy game** where every line your coworkers say, every unhinged decision, and every dollar of revenue is **generated live by an LLM**. You're the new Head of Sales at Veloura Technologies; your five underlings are enthusiastic, well-meaning, and completely off the rails. Survive **15 workplace crises** and one fiscal quarter, and hit **$1,000,000** โ€” by literally *arguing your way there*. **๐ŸŽฎ [Play it now](https://huggingface.co/spaces/build-small-hackathon/brad-did-something) ยท โ–ถ๏ธ [Watch the trailer](https://youtu.be/BJSE5WDZvPs)** ![Gameplay](docs/media/gameplay.gif) ## Not just a chatbot in a trenchcoat - **๐Ÿง  The AI is load-bearing.** NPC dialogue isn't decoration โ€” through strict JSON-schema validation the model's output *directly drives the game economy*. Talk Brad into rescuing a deal and revenue jumps; offend him and the pipeline collapses. The server hides the morale & relationship scores, so the model moves them without ever seeing (or gaming) them. - **๐ŸŽจ Comics on the fly.** Each crisis, the text model writes a scene and a second GPU renders a wordless **FLUX.2 [klein] 4B** comic panel that drops over the office โ€” the caption is drawn crisp by the UI (FLUX can't spell, so words stay out of the image). - **๐Ÿ•น๏ธ A genuinely custom frontend.** A hand-built HTML5-canvas + DOM pixel-art game served through **`gr.Server`** โ€” zero default Gradio widgets, desktop **and** touch. - **โš™๏ธ Small models, tight plumbing.** Qwen3.5-9B (llama.cpp) for text, FLUX.2- klein-4B for art, both on Modal GPUs, JSON-grammar-locked with a one-shot retry and a fast fallback so a slow call never kills the joke's timing. ๐Ÿ“– **[Read the full build story โ†’](https://huggingface.co/blog/build-small-hackathon/brad-did-something)** โ€” the sub-4B model bake-off, fighting the model's "helpful AI" reflex, and the comic pipeline. --- ## Run it yourself ```bash pip install -r requirements.txt python app.py # โ†’ http://localhost:7860 (mock mode: fully playable, no keys) ``` With no `MODAL_URL` set it uses a template-based offline generator. For the real AI, deploy the two Modal GPU apps and point the game at them: ```bash modal deploy modal_app/inference.py # Qwen3.5-9B text โ†’ MODAL_URL / MODAL_TOKEN modal deploy modal_app/image.py # FLUX.2-klein art โ†’ FLUX_URL / FLUX_TOKEN ``` On the HF Space these four go in **Settings โ†’ Secrets**; locally, `.\run_modal.ps1` wires them up for you. ## Deploy (HF Docker Space) Built on **`gr.Server`** so the custom FastAPI frontend *is* the app โ€” HF's `sdk: gradio` runner only launches a bare `demo`, so the Space runs `sdk: docker` with a `Dockerfile` that does `uvicorn app:app` on port 7860. Dry-run locally: `docker build -t bds . && docker run -p 7860:7860 bds`. ## Controls **WASD/arrows** move ยท **SPACE** talk / answer / advance comic ยท **G** gift ยท **1/2** choose ยท **ENTER** send a typed reply ยท **ESC** close ยท **M** mute. **๐Ÿ“ฑ Mobile:** an on-screen joystick + ACT/GIFT buttons appear automatically, and tapping the floor walks you there. ## Tests ```bash pytest tests/ # unit: validator, economy, events, comic, idle python tests/smoke_http.py # full-quarter API playthrough (mock) python tests/smoke_browser.py # headless-browser UI smoke ``` --- *Code MIT. Text model: Qwen3.5-9B (Apache-2.0). Image model: FLUX.2 [klein] 4B (non-commercial โ€” fine for this demo). Built for the Hugging Face **Build Small Hackathon**, "An Adventure in Thousand Token Wood."*