File size: 457 Bytes
4bdf735
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import type {ObjectDetectionOutput} from '@huggingface/transformers';

export type DetectionResult = ObjectDetectionOutput[number];

export type WorkerRequest =
  | {type: 'init'}
  | {type: 'detect'; id: number; threshold: number; frame: VideoFrame};

export type WorkerResponse =
  | {type: 'status'; message: string}
  | {type: 'ready'}
  | {type: 'detect-result'; id: number; results: DetectionResult[]}
  | {type: 'error'; error: string; id?: number};