--- title: LLM Cinema emoji: 🎬 colorFrom: green colorTo: gray sdk: gradio sdk_version: 6.16.0 app_file: server_app.py pinned: true short_description: A small LLM writes, draws & directs original ASCII films thumbnail: https://conductorailabs-llm-cinema.hf.space/static/share.png tags: - build-small-hackathon - thousand-token-wood - gradio - off-brand - field-notes - off-the-grid - llama-cpp - open-trace --- # 🎬 LLM Cinema A small model β€” **Cinema**, a fine-tuned **MiniCPM3-4B** β€” that **writes, draws, and directs ORIGINAL short films in ASCII**, and plays them **right here in the page**, streaming frame by frame. No video, no sound. Just imagination, one frame at a time. **Two ways to run it.** This hosted Space generates live via a cloud endpoint so you can try it instantly in the browser. It also ships as a fully **off-the-grid** build that runs the 4B model **locally through llama.cpp** β€” no cloud, no API β€” see [`LOCAL_LLAMACPP.md`](LOCAL_LLAMACPP.md). From a single concept it writes a 9-beat, ~90-second film: it invents the story, draws every character in ASCII, picks the terrain (water shimmers, grass, snow, lava…), the weather and time of day, camera moves (pan / push / shake), and a feeling for each character β€” then stages and plays it on a little charcoal terminal. ## πŸ† Hackathon submission **Track:** πŸ„ An Adventure in Thousand Token Wood β€” something delightful that wouldn't exist without AI. Here the model is *load-bearing*: it writes the story, draws every character, and directs the staging. The whole thing runs on a 4B model (MiniCPM3-4B β€” under the ≀32B cap, and under the ≀4B Tiny Titan bar). - **Live Space:** https://conductorailabs-llm-cinema.hf.space - **Demo video:** [β–Ά watch](https://huggingface.co/spaces/build-small-hackathon/llm-cinema/blob/main/media/llm_cinema.mp4) Β· [direct mp4](https://huggingface.co/spaces/build-small-hackathon/llm-cinema/resolve/main/media/llm_cinema.mp4) - **Social post:** https://www.linkedin.com/posts/jeff-middleton-10354b5_huggingface-llm-ai-ugcPost-7472422889783291904-7c9j - **Builder:** [ConductorAILabs](https://huggingface.co/ConductorAILabs) β€” registered + joined the build-small-hackathon org. **Bonus badges** - 🎨 **Off-Brand** β€” fully custom `gr.Server` frontend (cinema-hall backdrop, ASCII projected through the screen, reactive lighting), well past the default Gradio look. - πŸ”Œ **Off the Grid** β€” can optionally run **fully local** (no cloud APIs) via llama.cpp; see [`LOCAL_LLAMACPP.md`](LOCAL_LLAMACPP.md). - πŸ¦™ **Llama Champion** β€” the model runs through the **llama.cpp** runtime ([`serve_llamacpp.py`](serve_llamacpp.py)). - πŸ““ **Field Notes** β€” see [`FIELD_NOTES.md`](FIELD_NOTES.md). - πŸ“‘ **Open Trace** β€” the agent's scrubbed, secret-free build trace: [`traces/AGENT_TRACE.md`](traces/AGENT_TRACE.md). ## Try it - **🎬 Make a film** β€” type any concept (or hit *Surprise*) and watch Cinema write, draw, and play an original film live. - **🍿 Gallery** β€” hand-picked films that replay instantly, even before the model wakes. - **πŸ” Replay** the current film Β· **β›Ά Fullscreen** (mobile) for a cinema view. ## How it works - **Cinema** (LoRA-fine-tuned MiniCPM3-4B) emits a strict-JSON "movie script": title, logline, and shots (narration, cast, action, setting, camera, mood, dialogue). - A from-scratch ASCII engine resolves each character (a sprite library + a draw-on-demand model for anything new), composes the scene with z-ordered occlusion, textured floors and set-dressing (sun/moon, clouds, stars, trees), then animates and subtitles it. - A custom `gr.Server` frontend streams frames over SSE onto a cinema-hall backdrop, with reactive lighting that mirrors the on-screen action. - **Optionally**, the director model can run **entirely on your machine** through the **llama.cpp** runtime (GGUF) β€” no cloud APIs. (This hosted Space uses a cloud endpoint for the live demo.) Built for the **Build Small Hackathon** Β· the model & training pipeline stay private; this app is the demo. ## Run it β€” off the grid (primary) Everything runs on your own machine. The 4B model serves locally via **llama.cpp**, exposing an OpenAI-compatible endpoint that the app points at β€” no cloud, no keys. ```bash pip install -r requirements-local.txt # serve the local GGUF model (OpenAI-compatible, llama.cpp) on :8000 MODEL=./models/cinema-q4_k_m.gguf python serve_llamacpp.py # then, in another shell, point the app at it and open the cinema: export CLAUDEMOVIES_LLM_URL=http://localhost:8000/v1 export CLAUDEMOVIES_LLM_KEY=local # any non-empty string; not checked export CLAUDEMOVIES_LLM_MODEL=cinema python server_app.py ``` Full setup (GGUF conversion + quantization, llama.cpp build) is in [`LOCAL_LLAMACPP.md`](LOCAL_LLAMACPP.md). The **Gallery** plays even with no model running β€” films are pre-written β€” so the page always shows something instantly. ### Hosted demo (optional fallback) The same app can point at any hosted OpenAI-compatible endpoint via Space **secrets** (`CLAUDEMOVIES_LLM_URL` / `_MODEL` / `_KEY`) β€” nothing is committed to the repo. This is just a convenience for the live link; the off-grid local run is the real thing.