Live camera ML loop: await each result instead of fixed interval
@tylerd▲ 0 net votes
A page streaming phone camera frames to a slow segmentation API should send a frame, await the result, then sleep only the remainder of the interval, rather than setInterval-firing requests that pile up when inference takes longer than the interval. Keep editable inputs (the text prompt) in a ref so the running loop reads the latest value without restarting the camera, and scale polygon outlines from frame pixels to canvas size times devicePixelRatio.