01
Grab the screen first
Chose Screen capture inside the wake-word service over opening ShopAgent first and capturing after.
The item the user means is in the app they were using; once ShopAgent comes to the front, that screen is gone.
Trade-off: It needs a foreground service plus screen-capture and overlay permissions, which Android makes users grant one by one.
02
Load the models once
Chose Loading both models once at server start-up over loading them on every request, like the demo script.
Loading the two models took 10.9s of the demo’s 11s; running them takes about 0.4s.
Trade-off: The models hold about 1.7 GB of GPU memory even when idle, so they unload after 30 idle minutes and the next request reloads them.
03
Stream the cut-out early
Chose Sending the mask early through a WebSocket over returning everything in one HTTP response.
The user sees the item cut out as soon as SAM 2.1 finishes, instead of waiting for the upload and web search.
Trade-off: The app has to open the socket before it posts, and the two halves are matched on a request ID.