📄 src/lib/types.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
export interface Prediction {
  commonName: string;
  scientificName: string;
  confidence: number;
}

export type WorkerInMessage =
  | { type: "init" }
  | { type: "analyze"; samples: Float32Array };

export type WorkerOutMessage =
  | { type: "ready" }
  | { type: "error"; message: string }
  | { type: "results"; predictions: Prediction[] };