import { createContext } from "react"; export interface Detection { box_2d: [number, number, number, number]; // [y1, x1, y2, x2] normalized 0-1000 label: string; } export interface DetectionResult { text: string; detections: Detection[]; } export type LoadingStatus = | { state: "idle" } | { state: "loading"; progress?: number; message?: string } | { state: "ready" } | { state: "error"; error: string }; export interface LLMContextValue { status: LoadingStatus; isGenerating: boolean; tps: number; dtype: "q4f16" | "q4" | null; result: DetectionResult | null; loadModel: () => void; detect: (image: string, prompt: string) => void; stop: () => void; } export const LLMContext = createContext(null);