File size: 5,279 Bytes
0fd4b08
e93d4ef
 
 
0fd4b08
 
028024e
 
e93d4ef
 
dfa179e
e77c924
 
f795583
 
e77c924
 
f3dc594
 
4eabffd
0fd4b08
 
e93d4ef
 
 
 
 
 
06d05ac
 
 
b368d2e
e77c924
 
 
e93d4ef
 
e77c924
 
f795583
 
 
 
 
e77c924
7033e39
1b76aeb
f70bce6
f795583
 
 
 
 
25a06a1
f3dc594
f795583
4eabffd
e77c924
e93d4ef
 
e77c924
 
 
 
e93d4ef
 
 
 
 
e77c924
 
 
 
 
25a06a1
 
e93d4ef
e77c924
e93d4ef
 
b368d2e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e93d4ef
b368d2e
 
 
e93d4ef
b368d2e
e93d4ef
b368d2e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
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://huggingface.co/proxy/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://huggingface.co/proxy/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.