You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-49Lines changed: 50 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,62 +52,63 @@ make build
52
52
53
53
## Quick Start
54
54
55
-
PyTrickle is designed for simplicity. You can create a powerful real-time video processor by providing a few async functions to the `StreamProcessor`. This handles the server, state management, and model loading for you.
55
+
PyTrickle uses the FrameProcessor pattern for building video processing applications. See the complete example in `examples/async_processor_example.py`.
56
56
57
-
See a complete, runnable example in `examples/model_loading_example.py`.
58
-
59
-
### Simple Video Processor
60
-
61
-
Here's how to create a basic video processor that applies a green tint to video frames:
57
+
### Basic FrameProcessor
62
58
63
59
```python
64
-
import asyncio
65
-
import logging
66
-
from pytrickle import StreamProcessor
67
-
from pytrickle.frames import VideoFrame
68
-
69
-
logging.basicConfig(level=logging.INFO)
70
-
71
-
# 1. Define your model loading logic
72
-
asyncdefload_my_model(**kwargs):
73
-
"""Simulate loading a model. Runs in the background without blocking the server."""
74
-
logging.info("🔄 Model loading started...")
75
-
await asyncio.sleep(5) # Simulate a 5-second model load time
PyTrickle features a non-blocking model loading mechanism that allows the server to start immediately and be available for health checks while your model loads in the background.
105
-
106
-
-**Non-Blocking Startup**: The server starts instantly and responds to `/health` requests with a `LOADING` status.
107
-
-**Automatic Loading**: Your `model_loader` function is triggered automatically after startup.
108
-
-**State Transition**: Once your `model_loader` completes, the server's health status transitions from `LOADING` to `IDLE`, indicating it's ready to process streams.
109
-
110
-
This robust pattern is ideal for managed environments (like Docker or Kubernetes) where immediate health checks are critical for service orchestration. It is the recommended way to handle model initialization.
111
+
For a complete working example with green tint processing, see [`examples/process_video_example.py`](examples/process_video_example.py) and [`examples/model_loading_example.py`](examples/model_loading_example.py).
0 commit comments