Spaces:
Running
Running
Upload 37 files
Browse files
src/components/BoxAnnotator.ts
CHANGED
@@ -31,6 +31,7 @@ export function drawBoundingBoxesOnCanvas(
|
|
31 |
boxes: { bbox_2d: number[]; label?: string }[],
|
32 |
options?: { color?: string; lineWidth?: number; font?: string }
|
33 |
) {
|
|
|
34 |
const color = options?.color || "#00FF00";
|
35 |
const lineWidth = options?.lineWidth || 2;
|
36 |
const font = options?.font || "16px Arial";
|
|
|
31 |
boxes: { bbox_2d: number[]; label?: string }[],
|
32 |
options?: { color?: string; lineWidth?: number; font?: string }
|
33 |
) {
|
34 |
+
if (!Array.isArray(boxes)) return; // Prevent errors if boxes is undefined/null
|
35 |
const color = options?.color || "#00FF00";
|
36 |
const lineWidth = options?.lineWidth || 2;
|
37 |
const font = options?.font || "16px Arial";
|