Skip to main content
This guide pairs a brightness model with a Python script that checks its output. The model sends gray video frames and accepts a command that changes their brightness. It runs on a CPU and needs no model weights or API key. The script tests set_brightness and main_video from the model below. The spinning-logo model from the quickstart has different commands. Use the separate workspace below to keep both examples available.

Create a test workspace

Install the CLI and start Docker. You also need Python 3.10 or newer for the client script. Run the model and client on the same machine. Stop any model already using port 8080 before starting this one.
Keep the generated reactor.yaml, including its build.runtime_version and runtime.import: model:MyModel. Keep numpy in requirements.txt. Replace model.py in this workspace with the following:
model.py
Each frame is a NumPy array with shape (height, width, 3) and dtype uint8. The three channels are red, green, and blue. The runtime paces output at fps. A new session starts at brightness 128. The command accepts values from 0 to 255.

Build and run the model

From the brightness-test workspace, run:
Leave the model running in this terminal. It waits for a client on port 8080. After editing model.py or its dependencies, stop the model and run both commands again. reactor run reuses an existing image, so rebuild to include your changes.

Check video and commands

Open a second terminal in the brightness-test workspace. Install the Python client SDK and NumPy in a virtual environment:
Save the following as check_model.py in that workspace:
check_model.py
Run the check while the model runs:
The script sends set_brightness with values 128 and 220. For each command, it waits for a video frame with the expected brightness. The tolerance allows small differences from video compression. On success, it prints:
The script exits with an error if connection, command handling, or the expected video change times out. The context manager closes the client connection when the test ends. If the command fails, check that you replaced model.py in brightness-test and rebuilt the image. The spinning-logo model from the quickstart does not accept set_brightness.

Test your own model

Replace the sample with your model, then rebuild and run it. Adapt the command, payload, track name, and frame check in the script to your model. Also test invalid inputs and state reset in a new session. For this sample, brightness values outside 0 to 255 produce a validation error. A new session restores brightness to 128. A health response or command reply alone does not prove that media reached the client. This check verifies video delivery and command effects. It does not test GPU inference or model quality. See Using the SDK for other client operations.