@mediapipe/tasks-text 0.1.0-alpha-1669754728 → 0.1.0-alpha-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/text.d.ts +580 -117
- package/text_bundle.js +1 -1
package/text.d.ts
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
/// <reference types="@types/offscreencanvas" />
|
|
2
2
|
|
|
3
|
+
import * as jspb from 'google-protobuf';
|
|
4
|
+
|
|
5
|
+
declare class Acceleration extends jspb.Message {
|
|
6
|
+
hasXnnpack(): boolean;
|
|
7
|
+
clearXnnpack(): void;
|
|
8
|
+
getXnnpack(): mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Xnnpack | undefined;
|
|
9
|
+
setXnnpack(value?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Xnnpack): void;
|
|
10
|
+
|
|
11
|
+
hasGpu(): boolean;
|
|
12
|
+
clearGpu(): void;
|
|
13
|
+
getGpu(): mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Gpu | undefined;
|
|
14
|
+
setGpu(value?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Gpu): void;
|
|
15
|
+
|
|
16
|
+
hasTflite(): boolean;
|
|
17
|
+
clearTflite(): void;
|
|
18
|
+
getTflite(): mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.TfLite | undefined;
|
|
19
|
+
setTflite(value?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.TfLite): void;
|
|
20
|
+
|
|
21
|
+
getDelegateCase(): Acceleration.DelegateCase;
|
|
22
|
+
serializeBinary(): Uint8Array;
|
|
23
|
+
toObject(includeInstance?: boolean): Acceleration.AsObject;
|
|
24
|
+
static toObject(includeInstance: boolean, msg: Acceleration): Acceleration.AsObject;
|
|
25
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
26
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
27
|
+
static serializeBinaryToWriter(message: Acceleration, writer: jspb.BinaryWriter): void;
|
|
28
|
+
static deserializeBinary(bytes: Uint8Array): Acceleration;
|
|
29
|
+
static deserializeBinaryFromReader(message: Acceleration, reader: jspb.BinaryReader): Acceleration;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare namespace Acceleration {
|
|
33
|
+
type AsObject = {
|
|
34
|
+
xnnpack?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Xnnpack.AsObject,
|
|
35
|
+
gpu?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Gpu.AsObject,
|
|
36
|
+
tflite?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.TfLite.AsObject,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
enum DelegateCase {
|
|
40
|
+
DELEGATE_NOT_SET = 0,
|
|
41
|
+
XNNPACK = 1,
|
|
42
|
+
GPU = 2,
|
|
43
|
+
TFLITE = 4,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
3
47
|
/**
|
|
4
48
|
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
|
|
5
49
|
*
|
|
@@ -15,7 +59,7 @@
|
|
|
15
59
|
* See the License for the specific language governing permissions and
|
|
16
60
|
* limitations under the License.
|
|
17
61
|
*/
|
|
18
|
-
/** Options to configure MediaPipe
|
|
62
|
+
/** Options to configure MediaPipe model loading and processing. */
|
|
19
63
|
declare interface BaseOptions {
|
|
20
64
|
/**
|
|
21
65
|
* The model path to the model asset file. Only one of `modelAssetPath` or
|
|
@@ -31,6 +75,40 @@ declare interface BaseOptions {
|
|
|
31
75
|
delegate?: 'cpu' | 'gpu' | undefined;
|
|
32
76
|
}
|
|
33
77
|
|
|
78
|
+
declare class BaseOptions_2 extends jspb.Message {
|
|
79
|
+
hasModelAsset(): boolean;
|
|
80
|
+
clearModelAsset(): void;
|
|
81
|
+
getModelAsset(): mediapipe_tasks_cc_core_proto_external_file_pb.ExternalFile | undefined;
|
|
82
|
+
setModelAsset(value?: mediapipe_tasks_cc_core_proto_external_file_pb.ExternalFile): void;
|
|
83
|
+
|
|
84
|
+
hasUseStreamMode(): boolean;
|
|
85
|
+
clearUseStreamMode(): void;
|
|
86
|
+
getUseStreamMode(): boolean | undefined;
|
|
87
|
+
setUseStreamMode(value: boolean): void;
|
|
88
|
+
|
|
89
|
+
hasAcceleration(): boolean;
|
|
90
|
+
clearAcceleration(): void;
|
|
91
|
+
getAcceleration(): mediapipe_tasks_cc_core_proto_acceleration_pb.Acceleration | undefined;
|
|
92
|
+
setAcceleration(value?: mediapipe_tasks_cc_core_proto_acceleration_pb.Acceleration): void;
|
|
93
|
+
|
|
94
|
+
serializeBinary(): Uint8Array;
|
|
95
|
+
toObject(includeInstance?: boolean): BaseOptions_2.AsObject;
|
|
96
|
+
static toObject(includeInstance: boolean, msg: BaseOptions_2): BaseOptions_2.AsObject;
|
|
97
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
98
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
99
|
+
static serializeBinaryToWriter(message: BaseOptions_2, writer: jspb.BinaryWriter): void;
|
|
100
|
+
static deserializeBinary(bytes: Uint8Array): BaseOptions_2;
|
|
101
|
+
static deserializeBinaryFromReader(message: BaseOptions_2, reader: jspb.BinaryReader): BaseOptions_2;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare namespace BaseOptions_2 {
|
|
105
|
+
type AsObject = {
|
|
106
|
+
modelAsset?: mediapipe_tasks_cc_core_proto_external_file_pb.ExternalFile.AsObject,
|
|
107
|
+
useStreamMode?: boolean,
|
|
108
|
+
acceleration?: mediapipe_tasks_cc_core_proto_acceleration_pb.Acceleration.AsObject,
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
34
112
|
/**
|
|
35
113
|
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
|
|
36
114
|
*
|
|
@@ -209,6 +287,110 @@ export declare interface Embedding {
|
|
|
209
287
|
/** A listener that will be invoked with an absl::StatusCode and message. */
|
|
210
288
|
declare type ErrorListener = (code: number, message: string) => void;
|
|
211
289
|
|
|
290
|
+
declare class ExternalFile extends jspb.Message {
|
|
291
|
+
hasFileContent(): boolean;
|
|
292
|
+
clearFileContent(): void;
|
|
293
|
+
getFileContent(): Uint8Array | string;
|
|
294
|
+
getFileContent_asU8(): Uint8Array;
|
|
295
|
+
getFileContent_asB64(): string;
|
|
296
|
+
setFileContent(value: Uint8Array | string): void;
|
|
297
|
+
|
|
298
|
+
hasFileName(): boolean;
|
|
299
|
+
clearFileName(): void;
|
|
300
|
+
getFileName(): string | undefined;
|
|
301
|
+
setFileName(value: string): void;
|
|
302
|
+
|
|
303
|
+
hasFileDescriptorMeta(): boolean;
|
|
304
|
+
clearFileDescriptorMeta(): void;
|
|
305
|
+
getFileDescriptorMeta(): FileDescriptorMeta | undefined;
|
|
306
|
+
setFileDescriptorMeta(value?: FileDescriptorMeta): void;
|
|
307
|
+
|
|
308
|
+
hasFilePointerMeta(): boolean;
|
|
309
|
+
clearFilePointerMeta(): void;
|
|
310
|
+
getFilePointerMeta(): FilePointerMeta | undefined;
|
|
311
|
+
setFilePointerMeta(value?: FilePointerMeta): void;
|
|
312
|
+
|
|
313
|
+
serializeBinary(): Uint8Array;
|
|
314
|
+
toObject(includeInstance?: boolean): ExternalFile.AsObject;
|
|
315
|
+
static toObject(includeInstance: boolean, msg: ExternalFile): ExternalFile.AsObject;
|
|
316
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
317
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
318
|
+
static serializeBinaryToWriter(message: ExternalFile, writer: jspb.BinaryWriter): void;
|
|
319
|
+
static deserializeBinary(bytes: Uint8Array): ExternalFile;
|
|
320
|
+
static deserializeBinaryFromReader(message: ExternalFile, reader: jspb.BinaryReader): ExternalFile;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare namespace ExternalFile {
|
|
324
|
+
type AsObject = {
|
|
325
|
+
fileContent: Uint8Array | string,
|
|
326
|
+
fileName?: string,
|
|
327
|
+
fileDescriptorMeta?: FileDescriptorMeta.AsObject,
|
|
328
|
+
filePointerMeta?: FilePointerMeta.AsObject,
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare class FileDescriptorMeta extends jspb.Message {
|
|
333
|
+
hasFd(): boolean;
|
|
334
|
+
clearFd(): void;
|
|
335
|
+
getFd(): number | undefined;
|
|
336
|
+
setFd(value: number): void;
|
|
337
|
+
|
|
338
|
+
hasLength(): boolean;
|
|
339
|
+
clearLength(): void;
|
|
340
|
+
getLength(): number | undefined;
|
|
341
|
+
setLength(value: number): void;
|
|
342
|
+
|
|
343
|
+
hasOffset(): boolean;
|
|
344
|
+
clearOffset(): void;
|
|
345
|
+
getOffset(): number | undefined;
|
|
346
|
+
setOffset(value: number): void;
|
|
347
|
+
|
|
348
|
+
serializeBinary(): Uint8Array;
|
|
349
|
+
toObject(includeInstance?: boolean): FileDescriptorMeta.AsObject;
|
|
350
|
+
static toObject(includeInstance: boolean, msg: FileDescriptorMeta): FileDescriptorMeta.AsObject;
|
|
351
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
352
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
353
|
+
static serializeBinaryToWriter(message: FileDescriptorMeta, writer: jspb.BinaryWriter): void;
|
|
354
|
+
static deserializeBinary(bytes: Uint8Array): FileDescriptorMeta;
|
|
355
|
+
static deserializeBinaryFromReader(message: FileDescriptorMeta, reader: jspb.BinaryReader): FileDescriptorMeta;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
declare namespace FileDescriptorMeta {
|
|
359
|
+
type AsObject = {
|
|
360
|
+
fd?: number,
|
|
361
|
+
length?: number,
|
|
362
|
+
offset?: number,
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare class FilePointerMeta extends jspb.Message {
|
|
367
|
+
hasPointer(): boolean;
|
|
368
|
+
clearPointer(): void;
|
|
369
|
+
getPointer(): number | undefined;
|
|
370
|
+
setPointer(value: number): void;
|
|
371
|
+
|
|
372
|
+
hasLength(): boolean;
|
|
373
|
+
clearLength(): void;
|
|
374
|
+
getLength(): number | undefined;
|
|
375
|
+
setLength(value: number): void;
|
|
376
|
+
|
|
377
|
+
serializeBinary(): Uint8Array;
|
|
378
|
+
toObject(includeInstance?: boolean): FilePointerMeta.AsObject;
|
|
379
|
+
static toObject(includeInstance: boolean, msg: FilePointerMeta): FilePointerMeta.AsObject;
|
|
380
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
381
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
382
|
+
static serializeBinaryToWriter(message: FilePointerMeta, writer: jspb.BinaryWriter): void;
|
|
383
|
+
static deserializeBinary(bytes: Uint8Array): FilePointerMeta;
|
|
384
|
+
static deserializeBinaryFromReader(message: FilePointerMeta, reader: jspb.BinaryReader): FilePointerMeta;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare namespace FilePointerMeta {
|
|
388
|
+
type AsObject = {
|
|
389
|
+
pointer?: number,
|
|
390
|
+
length?: number,
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
212
394
|
/**
|
|
213
395
|
* Resolves the files required for the MediaPipe Task APIs.
|
|
214
396
|
*
|
|
@@ -702,21 +884,398 @@ declare class GraphRunner {
|
|
|
702
884
|
finishProcessing(): void;
|
|
703
885
|
}
|
|
704
886
|
|
|
887
|
+
/** An implementation of the GraphRunner that supports image operations */
|
|
888
|
+
declare class GraphRunnerImageLib extends GraphRunnerImageLibType {
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
declare const GraphRunnerImageLibType: (new (...args: any[]) => {
|
|
892
|
+
registerModelResourcesGraphService(): void;
|
|
893
|
+
readonly wasmModule: WasmModule;
|
|
894
|
+
readonly hasMultiStreamSupport: boolean;
|
|
895
|
+
autoResizeCanvas: boolean;
|
|
896
|
+
audioPtr: number | null;
|
|
897
|
+
audioSize: number;
|
|
898
|
+
initializeGraph(graphFile: string): Promise<void>;
|
|
899
|
+
setGraphFromString(graphConfig: string): void;
|
|
900
|
+
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
901
|
+
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
902
|
+
setAutoResizeCanvas(resize: boolean): void;
|
|
903
|
+
setAutoRenderToScreen(enabled: boolean): void;
|
|
904
|
+
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
905
|
+
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
906
|
+
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
907
|
+
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
908
|
+
setListener<T>(outputStreamName: string, callbackFcn: (data: T) => void): void;
|
|
909
|
+
setVectorListener<T_1>(outputStreamName: string, callbackFcn: (data: T_1[]) => void): void;
|
|
910
|
+
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
911
|
+
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
912
|
+
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
913
|
+
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
914
|
+
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
915
|
+
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
916
|
+
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
917
|
+
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
918
|
+
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
919
|
+
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
920
|
+
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
921
|
+
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
922
|
+
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
923
|
+
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
924
|
+
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
925
|
+
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
926
|
+
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
927
|
+
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
928
|
+
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
929
|
+
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
930
|
+
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
931
|
+
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
932
|
+
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
933
|
+
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
934
|
+
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
935
|
+
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
936
|
+
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
937
|
+
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
938
|
+
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
939
|
+
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
940
|
+
finishProcessing(): void;
|
|
941
|
+
}) & (new (...args: any[]) => {
|
|
942
|
+
addGpuBufferAsImageToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
943
|
+
readonly wasmModule: WasmModule;
|
|
944
|
+
readonly hasMultiStreamSupport: boolean;
|
|
945
|
+
autoResizeCanvas: boolean;
|
|
946
|
+
audioPtr: number | null;
|
|
947
|
+
audioSize: number;
|
|
948
|
+
initializeGraph(graphFile: string): Promise<void>;
|
|
949
|
+
setGraphFromString(graphConfig: string): void;
|
|
950
|
+
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
951
|
+
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
952
|
+
setAutoResizeCanvas(resize: boolean): void;
|
|
953
|
+
setAutoRenderToScreen(enabled: boolean): void;
|
|
954
|
+
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
955
|
+
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
956
|
+
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
957
|
+
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
958
|
+
setListener<T_2>(outputStreamName: string, callbackFcn: (data: T_2) => void): void;
|
|
959
|
+
setVectorListener<T_1_1>(outputStreamName: string, callbackFcn: (data: T_1_1[]) => void): void;
|
|
960
|
+
attachErrorListener(callbackFcn: (code: number, message: string) => void): void; /**
|
|
961
|
+
* Creates a new instance of a Mediapipe Task. Determines if SIMD is
|
|
962
|
+
* supported and loads the relevant WASM binary.
|
|
963
|
+
* @return A fully instantiated instance of `T`.
|
|
964
|
+
*/
|
|
965
|
+
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
966
|
+
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
967
|
+
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
968
|
+
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
969
|
+
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
970
|
+
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
971
|
+
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
972
|
+
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
973
|
+
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
974
|
+
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
975
|
+
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
976
|
+
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
977
|
+
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
978
|
+
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
979
|
+
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
980
|
+
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
981
|
+
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
982
|
+
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
983
|
+
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
984
|
+
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
985
|
+
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
986
|
+
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
987
|
+
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
988
|
+
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
989
|
+
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
990
|
+
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
991
|
+
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
992
|
+
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
993
|
+
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
994
|
+
finishProcessing(): void;
|
|
995
|
+
}) & typeof GraphRunner;
|
|
996
|
+
|
|
705
997
|
/**
|
|
706
998
|
* Valid types of image sources which we can run our GraphRunner over.
|
|
707
999
|
*/
|
|
708
1000
|
declare type ImageSource = HTMLCanvasElement | HTMLVideoElement | HTMLImageElement | ImageData | ImageBitmap;
|
|
709
1001
|
|
|
1002
|
+
declare class InferenceCalculatorOptions extends jspb.Message {
|
|
1003
|
+
hasModelPath(): boolean;
|
|
1004
|
+
clearModelPath(): void;
|
|
1005
|
+
getModelPath(): string | undefined;
|
|
1006
|
+
setModelPath(value: string): void;
|
|
1007
|
+
|
|
1008
|
+
hasUseGpu(): boolean;
|
|
1009
|
+
clearUseGpu(): void;
|
|
1010
|
+
getUseGpu(): boolean | undefined;
|
|
1011
|
+
setUseGpu(value: boolean): void;
|
|
1012
|
+
|
|
1013
|
+
hasUseNnapi(): boolean;
|
|
1014
|
+
clearUseNnapi(): void;
|
|
1015
|
+
getUseNnapi(): boolean | undefined;
|
|
1016
|
+
setUseNnapi(value: boolean): void;
|
|
1017
|
+
|
|
1018
|
+
hasCpuNumThread(): boolean;
|
|
1019
|
+
clearCpuNumThread(): void;
|
|
1020
|
+
getCpuNumThread(): number | undefined;
|
|
1021
|
+
setCpuNumThread(value: number): void;
|
|
1022
|
+
|
|
1023
|
+
hasDelegate(): boolean;
|
|
1024
|
+
clearDelegate(): void;
|
|
1025
|
+
getDelegate(): InferenceCalculatorOptions.Delegate | undefined;
|
|
1026
|
+
setDelegate(value?: InferenceCalculatorOptions.Delegate): void;
|
|
1027
|
+
|
|
1028
|
+
serializeBinary(): Uint8Array;
|
|
1029
|
+
toObject(includeInstance?: boolean): InferenceCalculatorOptions.AsObject;
|
|
1030
|
+
static toObject(includeInstance: boolean, msg: InferenceCalculatorOptions): InferenceCalculatorOptions.AsObject;
|
|
1031
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1032
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1033
|
+
static serializeBinaryToWriter(message: InferenceCalculatorOptions, writer: jspb.BinaryWriter): void;
|
|
1034
|
+
static deserializeBinary(bytes: Uint8Array): InferenceCalculatorOptions;
|
|
1035
|
+
static deserializeBinaryFromReader(message: InferenceCalculatorOptions, reader: jspb.BinaryReader): InferenceCalculatorOptions;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
declare namespace InferenceCalculatorOptions {
|
|
1039
|
+
type AsObject = {
|
|
1040
|
+
modelPath?: string,
|
|
1041
|
+
useGpu?: boolean,
|
|
1042
|
+
useNnapi?: boolean,
|
|
1043
|
+
cpuNumThread?: number,
|
|
1044
|
+
delegate?: InferenceCalculatorOptions.Delegate.AsObject,
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
class Delegate extends jspb.Message {
|
|
1048
|
+
hasTflite(): boolean;
|
|
1049
|
+
clearTflite(): void;
|
|
1050
|
+
getTflite(): InferenceCalculatorOptions.Delegate.TfLite | undefined;
|
|
1051
|
+
setTflite(value?: InferenceCalculatorOptions.Delegate.TfLite): void;
|
|
1052
|
+
|
|
1053
|
+
hasGpu(): boolean;
|
|
1054
|
+
clearGpu(): void;
|
|
1055
|
+
getGpu(): InferenceCalculatorOptions.Delegate.Gpu | undefined;
|
|
1056
|
+
setGpu(value?: InferenceCalculatorOptions.Delegate.Gpu): void;
|
|
1057
|
+
|
|
1058
|
+
hasNnapi(): boolean;
|
|
1059
|
+
clearNnapi(): void;
|
|
1060
|
+
getNnapi(): InferenceCalculatorOptions.Delegate.Nnapi | undefined;
|
|
1061
|
+
setNnapi(value?: InferenceCalculatorOptions.Delegate.Nnapi): void;
|
|
1062
|
+
|
|
1063
|
+
hasXnnpack(): boolean;
|
|
1064
|
+
clearXnnpack(): void;
|
|
1065
|
+
getXnnpack(): InferenceCalculatorOptions.Delegate.Xnnpack | undefined;
|
|
1066
|
+
setXnnpack(value?: InferenceCalculatorOptions.Delegate.Xnnpack): void;
|
|
1067
|
+
|
|
1068
|
+
getDelegateCase(): Delegate.DelegateCase;
|
|
1069
|
+
serializeBinary(): Uint8Array;
|
|
1070
|
+
toObject(includeInstance?: boolean): Delegate.AsObject;
|
|
1071
|
+
static toObject(includeInstance: boolean, msg: Delegate): Delegate.AsObject;
|
|
1072
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1073
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1074
|
+
static serializeBinaryToWriter(message: Delegate, writer: jspb.BinaryWriter): void;
|
|
1075
|
+
static deserializeBinary(bytes: Uint8Array): Delegate;
|
|
1076
|
+
static deserializeBinaryFromReader(message: Delegate, reader: jspb.BinaryReader): Delegate;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
namespace Delegate {
|
|
1080
|
+
type AsObject = {
|
|
1081
|
+
tflite?: InferenceCalculatorOptions.Delegate.TfLite.AsObject,
|
|
1082
|
+
gpu?: InferenceCalculatorOptions.Delegate.Gpu.AsObject,
|
|
1083
|
+
nnapi?: InferenceCalculatorOptions.Delegate.Nnapi.AsObject,
|
|
1084
|
+
xnnpack?: InferenceCalculatorOptions.Delegate.Xnnpack.AsObject,
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
class TfLite extends jspb.Message {
|
|
1088
|
+
serializeBinary(): Uint8Array;
|
|
1089
|
+
toObject(includeInstance?: boolean): TfLite.AsObject;
|
|
1090
|
+
static toObject(includeInstance: boolean, msg: TfLite): TfLite.AsObject;
|
|
1091
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1092
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1093
|
+
static serializeBinaryToWriter(message: TfLite, writer: jspb.BinaryWriter): void;
|
|
1094
|
+
static deserializeBinary(bytes: Uint8Array): TfLite;
|
|
1095
|
+
static deserializeBinaryFromReader(message: TfLite, reader: jspb.BinaryReader): TfLite;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
namespace TfLite {
|
|
1099
|
+
type AsObject = {
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
class Gpu extends jspb.Message {
|
|
1104
|
+
hasUseAdvancedGpuApi(): boolean;
|
|
1105
|
+
clearUseAdvancedGpuApi(): void;
|
|
1106
|
+
getUseAdvancedGpuApi(): boolean | undefined;
|
|
1107
|
+
setUseAdvancedGpuApi(value: boolean): void;
|
|
1108
|
+
|
|
1109
|
+
hasApi(): boolean;
|
|
1110
|
+
clearApi(): void;
|
|
1111
|
+
getApi(): InferenceCalculatorOptions.Delegate.Gpu.ApiMap[keyof InferenceCalculatorOptions.Delegate.Gpu.ApiMap] | undefined;
|
|
1112
|
+
setApi(value: InferenceCalculatorOptions.Delegate.Gpu.ApiMap[keyof InferenceCalculatorOptions.Delegate.Gpu.ApiMap]): void;
|
|
1113
|
+
|
|
1114
|
+
hasAllowPrecisionLoss(): boolean;
|
|
1115
|
+
clearAllowPrecisionLoss(): void;
|
|
1116
|
+
getAllowPrecisionLoss(): boolean | undefined;
|
|
1117
|
+
setAllowPrecisionLoss(value: boolean): void;
|
|
1118
|
+
|
|
1119
|
+
hasCachedKernelPath(): boolean;
|
|
1120
|
+
clearCachedKernelPath(): void;
|
|
1121
|
+
getCachedKernelPath(): string | undefined;
|
|
1122
|
+
setCachedKernelPath(value: string): void;
|
|
1123
|
+
|
|
1124
|
+
hasSerializedModelDir(): boolean;
|
|
1125
|
+
clearSerializedModelDir(): void;
|
|
1126
|
+
getSerializedModelDir(): string | undefined;
|
|
1127
|
+
setSerializedModelDir(value: string): void;
|
|
1128
|
+
|
|
1129
|
+
hasModelToken(): boolean;
|
|
1130
|
+
clearModelToken(): void;
|
|
1131
|
+
getModelToken(): string | undefined;
|
|
1132
|
+
setModelToken(value: string): void;
|
|
1133
|
+
|
|
1134
|
+
hasUsage(): boolean;
|
|
1135
|
+
clearUsage(): void;
|
|
1136
|
+
getUsage(): InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap[keyof InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap] | undefined;
|
|
1137
|
+
setUsage(value: InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap[keyof InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap]): void;
|
|
1138
|
+
|
|
1139
|
+
serializeBinary(): Uint8Array;
|
|
1140
|
+
toObject(includeInstance?: boolean): Gpu.AsObject;
|
|
1141
|
+
static toObject(includeInstance: boolean, msg: Gpu): Gpu.AsObject;
|
|
1142
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1143
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1144
|
+
static serializeBinaryToWriter(message: Gpu, writer: jspb.BinaryWriter): void;
|
|
1145
|
+
static deserializeBinary(bytes: Uint8Array): Gpu;
|
|
1146
|
+
static deserializeBinaryFromReader(message: Gpu, reader: jspb.BinaryReader): Gpu;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
namespace Gpu {
|
|
1150
|
+
type AsObject = {
|
|
1151
|
+
useAdvancedGpuApi?: boolean,
|
|
1152
|
+
api?: InferenceCalculatorOptions.Delegate.Gpu.ApiMap[keyof InferenceCalculatorOptions.Delegate.Gpu.ApiMap],
|
|
1153
|
+
allowPrecisionLoss?: boolean,
|
|
1154
|
+
cachedKernelPath?: string,
|
|
1155
|
+
serializedModelDir?: string,
|
|
1156
|
+
modelToken?: string,
|
|
1157
|
+
usage?: InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap[keyof InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap],
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
interface ApiMap {
|
|
1161
|
+
ANY: 0;
|
|
1162
|
+
OPENGL: 1;
|
|
1163
|
+
OPENCL: 2;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
const Api: ApiMap;
|
|
1167
|
+
|
|
1168
|
+
interface InferenceUsageMap {
|
|
1169
|
+
UNSPECIFIED: 0;
|
|
1170
|
+
FAST_SINGLE_ANSWER: 1;
|
|
1171
|
+
SUSTAINED_SPEED: 2;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
const InferenceUsage: InferenceUsageMap;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
class Nnapi extends jspb.Message {
|
|
1178
|
+
hasCacheDir(): boolean;
|
|
1179
|
+
clearCacheDir(): void;
|
|
1180
|
+
getCacheDir(): string | undefined;
|
|
1181
|
+
setCacheDir(value: string): void;
|
|
1182
|
+
|
|
1183
|
+
hasModelToken(): boolean;
|
|
1184
|
+
clearModelToken(): void;
|
|
1185
|
+
getModelToken(): string | undefined;
|
|
1186
|
+
setModelToken(value: string): void;
|
|
1187
|
+
|
|
1188
|
+
hasAcceleratorName(): boolean;
|
|
1189
|
+
clearAcceleratorName(): void;
|
|
1190
|
+
getAcceleratorName(): string | undefined;
|
|
1191
|
+
setAcceleratorName(value: string): void;
|
|
1192
|
+
|
|
1193
|
+
serializeBinary(): Uint8Array;
|
|
1194
|
+
toObject(includeInstance?: boolean): Nnapi.AsObject;
|
|
1195
|
+
static toObject(includeInstance: boolean, msg: Nnapi): Nnapi.AsObject;
|
|
1196
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1197
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1198
|
+
static serializeBinaryToWriter(message: Nnapi, writer: jspb.BinaryWriter): void;
|
|
1199
|
+
static deserializeBinary(bytes: Uint8Array): Nnapi;
|
|
1200
|
+
static deserializeBinaryFromReader(message: Nnapi, reader: jspb.BinaryReader): Nnapi;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
namespace Nnapi {
|
|
1204
|
+
type AsObject = {
|
|
1205
|
+
cacheDir?: string,
|
|
1206
|
+
modelToken?: string,
|
|
1207
|
+
acceleratorName?: string,
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
class Xnnpack extends jspb.Message {
|
|
1212
|
+
hasNumThreads(): boolean;
|
|
1213
|
+
clearNumThreads(): void;
|
|
1214
|
+
getNumThreads(): number | undefined;
|
|
1215
|
+
setNumThreads(value: number): void;
|
|
1216
|
+
|
|
1217
|
+
serializeBinary(): Uint8Array;
|
|
1218
|
+
toObject(includeInstance?: boolean): Xnnpack.AsObject;
|
|
1219
|
+
static toObject(includeInstance: boolean, msg: Xnnpack): Xnnpack.AsObject;
|
|
1220
|
+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1221
|
+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1222
|
+
static serializeBinaryToWriter(message: Xnnpack, writer: jspb.BinaryWriter): void;
|
|
1223
|
+
static deserializeBinary(bytes: Uint8Array): Xnnpack;
|
|
1224
|
+
static deserializeBinaryFromReader(message: Xnnpack, reader: jspb.BinaryReader): Xnnpack;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
namespace Xnnpack {
|
|
1228
|
+
type AsObject = {
|
|
1229
|
+
numThreads?: number,
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
enum DelegateCase {
|
|
1234
|
+
DELEGATE_NOT_SET = 0,
|
|
1235
|
+
TFLITE = 1,
|
|
1236
|
+
GPU = 2,
|
|
1237
|
+
NNAPI = 3,
|
|
1238
|
+
XNNPACK = 4,
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
const ext: jspb.ExtensionFieldInfo<InferenceCalculatorOptions>;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
declare namespace mediapipe_calculators_tensor_inference_calculator_pb {
|
|
1246
|
+
export {
|
|
1247
|
+
InferenceCalculatorOptions
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
declare namespace mediapipe_tasks_cc_core_proto_acceleration_pb {
|
|
1252
|
+
export {
|
|
1253
|
+
Acceleration
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
declare namespace mediapipe_tasks_cc_core_proto_external_file_pb {
|
|
1258
|
+
export {
|
|
1259
|
+
ExternalFile,
|
|
1260
|
+
FileDescriptorMeta,
|
|
1261
|
+
FilePointerMeta
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
|
|
710
1265
|
/** Base class for all MediaPipe Tasks. */
|
|
711
|
-
declare abstract class TaskRunner extends
|
|
1266
|
+
declare abstract class TaskRunner<O extends TaskRunnerOptions> {
|
|
1267
|
+
protected abstract baseOptions: BaseOptions_2;
|
|
1268
|
+
protected graphRunner: GraphRunnerImageLib;
|
|
712
1269
|
private processingErrors;
|
|
713
1270
|
/**
|
|
714
1271
|
* Creates a new instance of a Mediapipe Task. Determines if SIMD is
|
|
715
1272
|
* supported and loads the relevant WASM binary.
|
|
716
1273
|
* @return A fully instantiated instance of `T`.
|
|
717
1274
|
*/
|
|
718
|
-
protected static createInstance<T extends TaskRunner>(type: WasmMediaPipeConstructor<T>, initializeCanvas: boolean, fileset: WasmFileset): Promise<T>;
|
|
1275
|
+
protected static createInstance<T extends TaskRunner<O>, O extends TaskRunnerOptions>(type: WasmMediaPipeConstructor<T>, initializeCanvas: boolean, fileset: WasmFileset, options: O): Promise<T>;
|
|
719
1276
|
constructor(wasmModule: WasmModule, glCanvas?: HTMLCanvasElement | OffscreenCanvas | null);
|
|
1277
|
+
/** Configures the shared options of a MediaPipe Task. */
|
|
1278
|
+
setOptions(options: O): Promise<void>;
|
|
720
1279
|
/**
|
|
721
1280
|
* Takes the raw data from a MediaPipe graph, and passes it to C++ to be run
|
|
722
1281
|
* over the video stream. Will replace the previously running MediaPipe graph,
|
|
@@ -727,19 +1286,25 @@ declare abstract class TaskRunner extends WasmMediaPipeImageLib {
|
|
|
727
1286
|
* @param isBinary This should be set to true if the graph is in
|
|
728
1287
|
* binary format, and false if it is in human-readable text format.
|
|
729
1288
|
*/
|
|
730
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
1289
|
+
protected setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
731
1290
|
/**
|
|
732
1291
|
* Forces all queued-up packets to be pushed through the MediaPipe graph as
|
|
733
1292
|
* far as possible, performing all processing until no more processing can be
|
|
734
1293
|
* done.
|
|
735
1294
|
*/
|
|
736
|
-
finishProcessing(): void;
|
|
1295
|
+
protected finishProcessing(): void;
|
|
737
1296
|
/** Throws the error from the error listener if an error was raised. */
|
|
738
1297
|
private handleErrors;
|
|
739
1298
|
}
|
|
740
1299
|
|
|
1300
|
+
/** Options to configure MediaPipe Tasks in general. */
|
|
1301
|
+
declare interface TaskRunnerOptions {
|
|
1302
|
+
/** Options to configure the loading of the model assets. */
|
|
1303
|
+
baseOptions?: BaseOptions;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
741
1306
|
/** Performs Natural Language classification. */
|
|
742
|
-
export declare class TextClassifier extends TaskRunner {
|
|
1307
|
+
export declare class TextClassifier extends TaskRunner<TextClassifierOptions> {
|
|
743
1308
|
private classificationResult;
|
|
744
1309
|
private readonly options;
|
|
745
1310
|
/**
|
|
@@ -768,6 +1333,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
768
1333
|
* @param modelAssetPath The path to the model asset.
|
|
769
1334
|
*/
|
|
770
1335
|
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<TextClassifier>;
|
|
1336
|
+
constructor(wasmModule: WasmModule, glCanvas?: HTMLCanvasElement | OffscreenCanvas | null);
|
|
771
1337
|
/**
|
|
772
1338
|
* Sets new options for the text classifier.
|
|
773
1339
|
*
|
|
@@ -778,6 +1344,8 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
778
1344
|
* @param options The options for the text classifier.
|
|
779
1345
|
*/
|
|
780
1346
|
setOptions(options: TextClassifierOptions): Promise<void>;
|
|
1347
|
+
protected get baseOptions(): BaseOptions_2;
|
|
1348
|
+
protected set baseOptions(proto: BaseOptions_2);
|
|
781
1349
|
/**
|
|
782
1350
|
* Performs Natural Language classification on the provided text and waits
|
|
783
1351
|
* synchronously for the response.
|
|
@@ -791,7 +1359,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
791
1359
|
}
|
|
792
1360
|
|
|
793
1361
|
/** Options to configure the MediaPipe Text Classifier Task */
|
|
794
|
-
export declare interface TextClassifierOptions extends ClassifierOptions,
|
|
1362
|
+
export declare interface TextClassifierOptions extends ClassifierOptions, TaskRunnerOptions {
|
|
795
1363
|
}
|
|
796
1364
|
|
|
797
1365
|
/** Classification results of a model. */
|
|
@@ -813,7 +1381,7 @@ export declare interface TextClassifierResult {
|
|
|
813
1381
|
/**
|
|
814
1382
|
* Performs embedding extraction on text.
|
|
815
1383
|
*/
|
|
816
|
-
export declare class TextEmbedder extends TaskRunner {
|
|
1384
|
+
export declare class TextEmbedder extends TaskRunner<TextEmbedderOptions> {
|
|
817
1385
|
private embeddingResult;
|
|
818
1386
|
private readonly options;
|
|
819
1387
|
/**
|
|
@@ -842,6 +1410,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
842
1410
|
* @param modelAssetPath The path to the TFLite model.
|
|
843
1411
|
*/
|
|
844
1412
|
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<TextEmbedder>;
|
|
1413
|
+
constructor(wasmModule: WasmModule, glCanvas?: HTMLCanvasElement | OffscreenCanvas | null);
|
|
845
1414
|
/**
|
|
846
1415
|
* Sets new options for the text embedder.
|
|
847
1416
|
*
|
|
@@ -852,6 +1421,8 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
852
1421
|
* @param options The options for the text embedder.
|
|
853
1422
|
*/
|
|
854
1423
|
setOptions(options: TextEmbedderOptions): Promise<void>;
|
|
1424
|
+
protected get baseOptions(): BaseOptions_2;
|
|
1425
|
+
protected set baseOptions(proto: BaseOptions_2);
|
|
855
1426
|
/**
|
|
856
1427
|
* Performs embeding extraction on the provided text and waits synchronously
|
|
857
1428
|
* for the response.
|
|
@@ -875,7 +1446,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
875
1446
|
}
|
|
876
1447
|
|
|
877
1448
|
/** Options to configure the MediaPipe Text Embedder Task */
|
|
878
|
-
export declare interface TextEmbedderOptions extends EmbedderOptions,
|
|
1449
|
+
export declare interface TextEmbedderOptions extends EmbedderOptions, TaskRunnerOptions {
|
|
879
1450
|
}
|
|
880
1451
|
|
|
881
1452
|
/** Embedding results for a given embedder model. */
|
|
@@ -896,12 +1467,6 @@ export declare interface TextEmbedderResult {
|
|
|
896
1467
|
timestampMs?: number;
|
|
897
1468
|
}
|
|
898
1469
|
|
|
899
|
-
/** The options for configuring a MediaPipe Text task. */
|
|
900
|
-
declare interface TextTaskOptions {
|
|
901
|
-
/** Options to configure the loading of the model assets. */
|
|
902
|
-
baseOptions?: BaseOptions;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
1470
|
/**
|
|
906
1471
|
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
|
|
907
1472
|
*
|
|
@@ -931,108 +1496,6 @@ declare interface WasmFileset {
|
|
|
931
1496
|
*/
|
|
932
1497
|
declare type WasmMediaPipeConstructor<LibType> = (new (module: WasmModule, canvas?: HTMLCanvasElement | OffscreenCanvas | null) => LibType);
|
|
933
1498
|
|
|
934
|
-
declare const WasmMediaPipeImageLib: (new (...args: any[]) => {
|
|
935
|
-
registerModelResourcesGraphService(): void;
|
|
936
|
-
readonly wasmModule: WasmModule;
|
|
937
|
-
readonly hasMultiStreamSupport: boolean;
|
|
938
|
-
autoResizeCanvas: boolean;
|
|
939
|
-
audioPtr: number | null;
|
|
940
|
-
audioSize: number;
|
|
941
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
942
|
-
setGraphFromString(graphConfig: string): void;
|
|
943
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
944
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
945
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
946
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
947
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
948
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
949
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
950
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
951
|
-
setListener<T>(outputStreamName: string, callbackFcn: (data: T) => void): void;
|
|
952
|
-
setVectorListener<T_1>(outputStreamName: string, callbackFcn: (data: T_1[]) => void): void;
|
|
953
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
954
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
955
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
956
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
957
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
958
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
959
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
960
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
961
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
962
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
963
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
964
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
965
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
966
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
967
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
968
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
969
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
970
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
971
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
972
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
973
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
974
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
975
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
976
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
977
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
978
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
979
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
980
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
981
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
982
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
983
|
-
finishProcessing(): void;
|
|
984
|
-
}) & (new (...args: any[]) => {
|
|
985
|
-
addGpuBufferAsImageToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
986
|
-
readonly wasmModule: WasmModule;
|
|
987
|
-
readonly hasMultiStreamSupport: boolean;
|
|
988
|
-
autoResizeCanvas: boolean;
|
|
989
|
-
audioPtr: number | null;
|
|
990
|
-
audioSize: number;
|
|
991
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
992
|
-
setGraphFromString(graphConfig: string): void;
|
|
993
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
994
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
995
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
996
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
997
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
998
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
999
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
1000
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
1001
|
-
setListener<T_2>(outputStreamName: string, callbackFcn: (data: T_2) => void): void;
|
|
1002
|
-
setVectorListener<T_1_1>(outputStreamName: string, callbackFcn: (data: T_1_1[]) => void): void;
|
|
1003
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
1004
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
1005
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
1006
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
1007
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
1008
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
1009
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
1010
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
1011
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
1012
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
1013
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
1014
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
1015
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1016
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1017
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1018
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
1019
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
1020
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
1021
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
1022
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1023
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1024
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1025
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1026
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1027
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1028
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
1029
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
1030
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1031
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1032
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1033
|
-
finishProcessing(): void;
|
|
1034
|
-
}) & typeof GraphRunner;
|
|
1035
|
-
|
|
1036
1499
|
/**
|
|
1037
1500
|
* Declarations for Emscripten's WebAssembly Module behavior, so TS compiler
|
|
1038
1501
|
* doesn't break our JS/C++ bridge.
|