Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ mise run ws-e2e-chrome

## Run ws agent in browser

### HAR model setup

Download the onnx from https://modelnova.ai/models/details/human-activity-recognition ,
and save it as `services/ws-server/static/models/human_activity_recognition.onnx`

### Face detection setup

Download the onnx from https://huggingface.co/amd/retinaface and save it in
`services/ws-server/static/models/` and rename the file to `video_cv.onnx`.

### Build and run the agent

```bash
mise run build-ws-wasm-agent
mise run ws-server
Expand All @@ -35,6 +44,7 @@ which will normally be something like 192.168.1.x.
Then on your phone, open Chrome and type in https://192.168.1.x:8433/

Click "Load HAR model" and then "Start sensors".
For webcam inference, click "Load video CV model" and then "Start video".

## Grant

Expand Down
21 changes: 21 additions & 0 deletions services/ws-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,27 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for WebSocketActor {
action,
details,
} => {
if capability == "video_cv" && action == "inference" {
let detected_class = details
.get("detected_class")
.and_then(|value| value.as_str())
.unwrap_or("unknown");
let confidence = details
.get("confidence")
.and_then(|value| value.as_f64())
.unwrap_or_default();
let processed_at = details
.get("processed_at")
.and_then(|value| value.as_str())
.unwrap_or("unknown");
info!(
"Video inference received from {}: class={} confidence={:.4} processed_at={}",
self.current_agent_id(),
detected_class,
confidence,
processed_at
);
}
info!(
"Client event from {}: capability={} action={} details={}",
self.current_agent_id(),
Expand Down
Loading
Loading