Skip to content

Commit bf63869

Browse files
Release v1.25.0
1 parent e002b8a commit bf63869

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

cli-common/make-image.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fetch, FormData } from 'undici';
44
import { Blob } from 'node:buffer';
55
import { Config, EdgeImpulseConfig } from './config';
66
import encodeLabel from '../shared/encoding';
7-
import { ExportBoundingBoxesFileV1, ExportInputBoundingBox, ExportStructuredLabelsFileV1,
7+
import { ExportBoundingBoxesFileV1, ExportInputBoundingBox, ExportLabelMapFileV1, ExportStructuredLabelsFileV1,
88
ExportUploaderInfoFileCategory, ExportUploaderInfoFileLabel } from '../shared/bounding-box-file-types';
99

1010
export const EXTENSION_MAPPING: { [k: string]: string } = {
@@ -81,6 +81,9 @@ export async function upload(opts: {
8181
else if (opts.label.type === 'multi-label') {
8282
// gets set with a separate file, see below
8383
}
84+
else if (opts.label.type === 'keyvalue-labels') {
85+
// gets set with a separate file, see below
86+
}
8487

8588
if (!opts.allowDuplicates) {
8689
headers['x-disallow-duplicates'] = '1';
@@ -122,6 +125,18 @@ export async function upload(opts: {
122125
type: 'application/json',
123126
}), 'bounding_boxes.labels');
124127
}
128+
if (opts.label.type === 'keyvalue-labels') {
129+
const labelMapFile: ExportLabelMapFileV1 = {
130+
version: 1,
131+
type: 'label-map-labels',
132+
labels: {
133+
[opts.filename]: opts.label.labels,
134+
},
135+
};
136+
form.append('data', new Blob([ JSON.stringify(labelMapFile) ], {
137+
type: 'application/json',
138+
}), 'label_map.labels');
139+
}
125140

126141
let res = await fetch(opts.config.endpoints.internal.ingestion + '/api/' + category + '/files', {
127142
method: 'POST',

0 commit comments

Comments
 (0)