Spaces:
Running
Running
Upload 37 files
Browse files
src/components/MultiSourceCaptioningView.tsx
CHANGED
@@ -19,7 +19,10 @@ function parseFlatBoxArray(arr: any[]): { label: string, bbox_2d: number[] }[] {
|
|
19 |
function normalizeBoxes(raw: any): { label: string, bbox_2d: number[] }[] {
|
20 |
if (!raw) return [];
|
21 |
let boxes = [];
|
22 |
-
|
|
|
|
|
|
|
23 |
boxes = raw;
|
24 |
} else if (typeof raw === "object" && raw !== null) {
|
25 |
boxes = [raw];
|
|
|
19 |
function normalizeBoxes(raw: any): { label: string, bbox_2d: number[] }[] {
|
20 |
if (!raw) return [];
|
21 |
let boxes = [];
|
22 |
+
// If the object has an 'image' property that is an array, use that
|
23 |
+
if (typeof raw === "object" && raw !== null && Array.isArray(raw.image)) {
|
24 |
+
boxes = raw.image;
|
25 |
+
} else if (Array.isArray(raw)) {
|
26 |
boxes = raw;
|
27 |
} else if (typeof raw === "object" && raw !== null) {
|
28 |
boxes = [raw];
|