C API

From westwind-zephyr, header <westwind/result.h>:

enum ww_result_kind {
	WW_RESULT_CLASSIFY,
	WW_RESULT_DETECTION,
	WW_RESULT_SEGMENTATION,
	WW_RESULT_KEYPOINTS,
	WW_RESULT_ANOMALY,
	WW_RESULT_KWS,
};

struct ww_label {
	const char *label;
	uint16_t index;
	float score;
};

struct ww_box {
	float x, y, w, h;
	float score;
	uint16_t label;
};

struct ww_keypoint {
	float x, y;
	float score;
};

struct ww_result {
	enum ww_result_kind kind;
	uint32_t seq;
	int64_t timestamp_ms;
	uint32_t infer_us;
	uint16_t count;
	const struct ww_label *labels;
	const struct ww_box *boxes;
	const struct ww_keypoint *keypoints;
	const uint8_t *mask;
	uint16_t mask_width;
	uint16_t mask_height;
	float value;
};

/* Called from the pipeline thread for every result. Weak; define it in
 * application code to act on results. */
void ww_on_result(const struct ww_result *res);

Code written in the web application's C or C++ editor, or generated from Blockly, implements ww_on_result() in src/app_logic.c (or .cpp). Python code is a training recipe (build_model(), optionally load_data(path, model) and export_module(model, stats); see westwind.train) or a host-side handler for westwind serve (handle(request) -> dict).