File size: 3,583 Bytes
2a9b8d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20905e1
2a9b8d1
20905e1
 
2a9b8d1
 
8536e24
114ea19
 
 
 
 
2a9b8d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8536e24
 
 
 
 
 
2a9b8d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Tiny Trigger Demo Runbook

Use this if you need to run the demo without rebuilding context.

## Launch

```bash
pip install -r requirements.txt
python server.py
```

Or:

```bash
poetry install
poetry run python server.py
```

Open:

```text
http://127.0.0.1:7860
```

For Hugging Face Spaces, the entrypoint is `server.py`; it serves the already
built frontend from `frontend/dist`.

## API Keys

Open Settings, choose one compiler provider, and paste its API key:

- Replicate: `REPLICATE_API_TOKEN`
- OpenAI: `OPENAI_API_KEY`
- Claude: `ANTHROPIC_API_KEY`

Keys pasted in the UI are only sent with compile requests. If you own the Space,
set the matching variable as a Space secret instead.

## Demo Video

No demo video is checked in yet. Record a short MP4 or MOV with:

- one obvious person or hand
- one clear object such as guitar, monitor, steering wheel, cup, laptop, chair
- at least one moment where the object appears or disappears
- 5-15 seconds is enough

The detector downloads YOLOE weights on first use, so the first run can be slow.

Recommended starting detector settings:

- Classes: leave defaults, or add obvious objects from the video.
- Confidence: `0.15` for normal objects, `0.05` if detections are missing.
- Sample interval: `1.0s`.
- Max frames: `120`.
- Model size: Small for speed, Large/XLarge for a stronger demo.
- Resolution: `640` by default, `960` or `1280` if detections are missing.

Rules automatically add their referenced labels to the detector class list.
Rules can use presence, count, near, far, moving, enter, exit, change, and
cooldown. Moving uses detector-provided track IDs across sampled frames; YOLOE
uses Ultralytics ByteTrack only when active rules include motion. It requires at
least three tracked observations and tolerates one missed sampled frame by
default. Speed, direction, long-gap re-identification, and trajectory paths are
not supported yet.

## Prompts To Try

State assertion, should fire once when true:

```text
While there is a guitar in the scene, amplifier must be on.
```

Enter/exit behavior:

```text
If a person is near the monitor, turn on the LED lights. When the person leaves, turn them off.
```

Cooldown behavior:

```text
If a person is near the steering wheel, turn on the PC. Do not repeat for five minutes.
```

Simple presence:

```text
When a laptop is visible, notify me.
```

Simple motion:

```text
If a car is moving, notify me.
```

## Expected Flow

1. Upload the video in Detector.
2. Go to Settings and choose a cloud compiler provider.
3. Paste the API key if the Space has no secret configured.
4. Go to Rule Studio, Compose.
5. Compile one of the prompts above.
6. Check Source to see the generated rule document.
7. Check Rules to see enabled rules and label pills.
8. Run detection.
9. Watch Activity & Firings for fired actions.
10. Use the replay to inspect detections and event timing.

## What To Say

Tiny Trigger turns natural language video automation ideas into validated rules.
The LLM only writes JSON/YAML, never executable code. YOLOE searches both user
classes and labels referenced by active rules. Rules use edge triggers by
default, so "turn on when present" does not spam every frame.

## If Something Fails

- No compile: check the provider and API key.
- No detections: lower confidence, add labels manually, or try a larger YOLOE model.
- Slow first run: model weights are downloading.
- Repeated actions: check the rule trigger. For most demos, prefer `enter` or `change`.
- Missing frontend in a Space: make sure `frontend/dist` is included in the upload.