react-native-executorch 0.5.1 → 0.5.2

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.
Files changed (126) hide show
  1. package/lib/Error.d.ts +30 -0
  2. package/lib/Error.js +50 -0
  3. package/lib/common/Logger.d.ts +8 -0
  4. package/lib/common/Logger.js +19 -0
  5. package/lib/constants/directories.d.ts +1 -0
  6. package/lib/constants/directories.js +2 -0
  7. package/lib/constants/llmDefaults.d.ts +6 -0
  8. package/lib/constants/llmDefaults.js +16 -0
  9. package/lib/constants/modelUrls.d.ts +223 -0
  10. package/lib/constants/modelUrls.js +322 -0
  11. package/lib/constants/ocr/models.d.ts +882 -0
  12. package/lib/constants/ocr/models.js +182 -0
  13. package/lib/constants/ocr/symbols.d.ts +75 -0
  14. package/lib/constants/ocr/symbols.js +139 -0
  15. package/lib/constants/sttDefaults.d.ts +28 -0
  16. package/lib/constants/sttDefaults.js +68 -0
  17. package/lib/controllers/LLMController.d.ts +47 -0
  18. package/lib/controllers/LLMController.js +213 -0
  19. package/lib/controllers/OCRController.d.ts +23 -0
  20. package/lib/controllers/OCRController.js +72 -0
  21. package/lib/controllers/SpeechToTextController.d.ts +56 -0
  22. package/lib/controllers/SpeechToTextController.js +349 -0
  23. package/lib/controllers/VerticalOCRController.d.ts +25 -0
  24. package/lib/controllers/VerticalOCRController.js +75 -0
  25. package/lib/hooks/computer_vision/useClassification.d.ts +15 -0
  26. package/lib/hooks/computer_vision/useClassification.js +7 -0
  27. package/lib/hooks/computer_vision/useImageEmbeddings.d.ts +15 -0
  28. package/lib/hooks/computer_vision/useImageEmbeddings.js +7 -0
  29. package/lib/hooks/computer_vision/useImageSegmentation.d.ts +38 -0
  30. package/lib/hooks/computer_vision/useImageSegmentation.js +7 -0
  31. package/lib/hooks/computer_vision/useOCR.d.ts +20 -0
  32. package/lib/hooks/computer_vision/useOCR.js +42 -0
  33. package/lib/hooks/computer_vision/useObjectDetection.d.ts +15 -0
  34. package/lib/hooks/computer_vision/useObjectDetection.js +7 -0
  35. package/lib/hooks/computer_vision/useStyleTransfer.d.ts +15 -0
  36. package/lib/hooks/computer_vision/useStyleTransfer.js +7 -0
  37. package/lib/hooks/computer_vision/useVerticalOCR.d.ts +21 -0
  38. package/lib/hooks/computer_vision/useVerticalOCR.js +45 -0
  39. package/lib/hooks/general/useExecutorchModule.d.ts +13 -0
  40. package/lib/hooks/general/useExecutorchModule.js +7 -0
  41. package/lib/hooks/natural_language_processing/useLLM.d.ts +10 -0
  42. package/lib/hooks/natural_language_processing/useLLM.js +78 -0
  43. package/lib/hooks/natural_language_processing/useSpeechToText.d.ts +27 -0
  44. package/lib/hooks/natural_language_processing/useSpeechToText.js +49 -0
  45. package/lib/hooks/natural_language_processing/useTextEmbeddings.d.ts +16 -0
  46. package/lib/hooks/natural_language_processing/useTextEmbeddings.js +7 -0
  47. package/lib/hooks/natural_language_processing/useTokenizer.d.ts +17 -0
  48. package/lib/hooks/natural_language_processing/useTokenizer.js +52 -0
  49. package/lib/hooks/useModule.d.ts +17 -0
  50. package/lib/hooks/useModule.js +45 -0
  51. package/lib/hooks/useNonStaticModule.d.ts +20 -0
  52. package/lib/hooks/useNonStaticModule.js +49 -0
  53. package/lib/index.d.ts +50 -0
  54. package/lib/index.js +60 -0
  55. package/lib/module/utils/ResourceFetcher.js +6 -8
  56. package/lib/module/utils/ResourceFetcher.js.map +1 -1
  57. package/lib/module/utils/ResourceFetcherUtils.js +20 -20
  58. package/lib/module/utils/ResourceFetcherUtils.js.map +1 -1
  59. package/lib/modules/BaseModule.d.ts +8 -0
  60. package/lib/modules/BaseModule.js +25 -0
  61. package/lib/modules/BaseNonStaticModule.d.ts +9 -0
  62. package/lib/modules/BaseNonStaticModule.js +14 -0
  63. package/lib/modules/computer_vision/ClassificationModule.d.ts +8 -0
  64. package/lib/modules/computer_vision/ClassificationModule.js +17 -0
  65. package/lib/modules/computer_vision/ImageEmbeddingsModule.d.ts +8 -0
  66. package/lib/modules/computer_vision/ImageEmbeddingsModule.js +17 -0
  67. package/lib/modules/computer_vision/ImageSegmentationModule.d.ts +11 -0
  68. package/lib/modules/computer_vision/ImageSegmentationModule.js +27 -0
  69. package/lib/modules/computer_vision/OCRModule.d.ts +15 -0
  70. package/lib/modules/computer_vision/OCRModule.js +20 -0
  71. package/lib/modules/computer_vision/ObjectDetectionModule.d.ts +9 -0
  72. package/lib/modules/computer_vision/ObjectDetectionModule.js +17 -0
  73. package/lib/modules/computer_vision/StyleTransferModule.d.ts +8 -0
  74. package/lib/modules/computer_vision/StyleTransferModule.js +17 -0
  75. package/lib/modules/computer_vision/VerticalOCRModule.d.ts +15 -0
  76. package/lib/modules/computer_vision/VerticalOCRModule.js +22 -0
  77. package/lib/modules/general/ExecutorchModule.d.ts +7 -0
  78. package/lib/modules/general/ExecutorchModule.js +14 -0
  79. package/lib/modules/natural_language_processing/LLMModule.d.ts +28 -0
  80. package/lib/modules/natural_language_processing/LLMModule.js +45 -0
  81. package/lib/modules/natural_language_processing/SpeechToTextModule.d.ts +24 -0
  82. package/lib/modules/natural_language_processing/SpeechToTextModule.js +36 -0
  83. package/lib/modules/natural_language_processing/TextEmbeddingsModule.d.ts +9 -0
  84. package/lib/modules/natural_language_processing/TextEmbeddingsModule.js +21 -0
  85. package/lib/modules/natural_language_processing/TokenizerModule.d.ts +12 -0
  86. package/lib/modules/natural_language_processing/TokenizerModule.js +30 -0
  87. package/lib/native/NativeETInstaller.d.ts +6 -0
  88. package/lib/native/NativeETInstaller.js +2 -0
  89. package/lib/native/NativeOCR.d.ts +8 -0
  90. package/lib/native/NativeOCR.js +2 -0
  91. package/lib/native/NativeVerticalOCR.d.ts +8 -0
  92. package/lib/native/NativeVerticalOCR.js +2 -0
  93. package/lib/native/RnExecutorchModules.d.ts +3 -0
  94. package/lib/native/RnExecutorchModules.js +16 -0
  95. package/lib/types/common.d.ts +31 -0
  96. package/lib/types/common.js +25 -0
  97. package/lib/types/imageSegmentation.d.ts +24 -0
  98. package/lib/types/imageSegmentation.js +26 -0
  99. package/lib/types/llm.d.ts +46 -0
  100. package/lib/types/llm.js +9 -0
  101. package/lib/types/objectDetection.d.ts +104 -0
  102. package/lib/types/objectDetection.js +94 -0
  103. package/lib/types/ocr.d.ts +11 -0
  104. package/lib/types/ocr.js +1 -0
  105. package/lib/types/stt.d.ts +94 -0
  106. package/lib/types/stt.js +85 -0
  107. package/lib/typescript/utils/ResourceFetcher.d.ts.map +1 -1
  108. package/lib/typescript/utils/ResourceFetcherUtils.d.ts.map +1 -1
  109. package/lib/utils/ResourceFetcher.d.ts +24 -0
  110. package/lib/utils/ResourceFetcher.js +305 -0
  111. package/lib/utils/ResourceFetcherUtils.d.ts +54 -0
  112. package/lib/utils/ResourceFetcherUtils.js +128 -0
  113. package/lib/utils/llm.d.ts +6 -0
  114. package/lib/utils/llm.js +73 -0
  115. package/lib/utils/stt.d.ts +1 -0
  116. package/lib/utils/stt.js +21 -0
  117. package/package.json +1 -1
  118. package/src/utils/ResourceFetcher.ts +9 -7
  119. package/src/utils/ResourceFetcherUtils.ts +15 -17
  120. package/ios/RnExecutorch.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  121. package/ios/RnExecutorch.xcodeproj/project.xcworkspace/xcuserdata/jakubchmura.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  122. package/ios/RnExecutorch.xcodeproj/xcuserdata/jakubchmura.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  123. package/lib/tsconfig.tsbuildinfo +0 -1
  124. package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  125. package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/xcuserdata/jakubchmura.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  126. package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/xcuserdata/jakubchmura.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
@@ -0,0 +1,21 @@
1
+ import { ResourceFetcher } from '../../utils/ResourceFetcher';
2
+ import { BaseNonStaticModule } from '../BaseNonStaticModule';
3
+ export class TextEmbeddingsModule extends BaseNonStaticModule {
4
+ async load(model, onDownloadProgressCallback = () => { }) {
5
+ const modelPromise = ResourceFetcher.fetch(onDownloadProgressCallback, model.modelSource);
6
+ const tokenizerPromise = ResourceFetcher.fetch(undefined, model.tokenizerSource);
7
+ const [modelResult, tokenizerResult] = await Promise.all([
8
+ modelPromise,
9
+ tokenizerPromise,
10
+ ]);
11
+ const modelPath = modelResult?.[0];
12
+ const tokenizerPath = tokenizerResult?.[0];
13
+ if (!modelPath || !tokenizerPath) {
14
+ throw new Error('Download interrupted.');
15
+ }
16
+ this.nativeModule = global.loadTextEmbeddings(modelPath, tokenizerPath);
17
+ }
18
+ async forward(input) {
19
+ return new Float32Array(await this.nativeModule.generate(input));
20
+ }
21
+ }
@@ -0,0 +1,12 @@
1
+ import { ResourceSource } from '../../types/common';
2
+ export declare class TokenizerModule {
3
+ nativeModule: any;
4
+ load(tokenizer: {
5
+ tokenizerSource: ResourceSource;
6
+ }, onDownloadProgressCallback?: (progress: number) => void): Promise<void>;
7
+ encode(s: string): Promise<any>;
8
+ decode(tokens: number[], skipSpecialTokens?: boolean): Promise<any>;
9
+ getVocabSize(): Promise<number>;
10
+ idToToken(tokenId: number): Promise<string>;
11
+ tokenToId(token: string): Promise<number>;
12
+ }
@@ -0,0 +1,30 @@
1
+ import { ResourceFetcher } from '../../utils/ResourceFetcher';
2
+ export class TokenizerModule {
3
+ nativeModule;
4
+ async load(tokenizer, onDownloadProgressCallback = () => { }) {
5
+ const paths = await ResourceFetcher.fetch(onDownloadProgressCallback, tokenizer.tokenizerSource);
6
+ const path = paths?.[0];
7
+ if (!path) {
8
+ throw new Error('Download interrupted.');
9
+ }
10
+ this.nativeModule = global.loadTokenizerModule(path);
11
+ }
12
+ async encode(s) {
13
+ return await this.nativeModule.encode(s);
14
+ }
15
+ async decode(tokens, skipSpecialTokens = true) {
16
+ if (tokens.length === 0) {
17
+ return '';
18
+ }
19
+ return await this.nativeModule.decode(tokens, skipSpecialTokens);
20
+ }
21
+ async getVocabSize() {
22
+ return await this.nativeModule.getVocabSize();
23
+ }
24
+ async idToToken(tokenId) {
25
+ return this.nativeModule.idToToken(tokenId);
26
+ }
27
+ async tokenToId(token) {
28
+ return await this.nativeModule.tokenToId(token);
29
+ }
30
+ }
@@ -0,0 +1,6 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ install(): boolean;
4
+ }
5
+ declare const _default: Spec | null;
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.get('ETInstaller');
@@ -0,0 +1,8 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { OCRDetection } from '../types/ocr';
3
+ export interface Spec extends TurboModule {
4
+ loadModule(detectorSource: string, recognizerSourceLarge: string, recognizerSourceMedium: string, recognizerSourceSmall: string, symbols: string): Promise<number>;
5
+ forward(input: string): Promise<OCRDetection[]>;
6
+ }
7
+ declare const _default: Spec | null;
8
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.get('OCR');
@@ -0,0 +1,8 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { OCRDetection } from '../types/ocr';
3
+ export interface Spec extends TurboModule {
4
+ loadModule(detectorLargeSource: string, detectorNarrowSource: string, recognizerSource: string, symbols: string, independentCharacters: boolean): Promise<number>;
5
+ forward(input: string): Promise<OCRDetection[]>;
6
+ }
7
+ declare const _default: Spec | null;
8
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.get('VerticalOCR');
@@ -0,0 +1,3 @@
1
+ import { Spec as ETInstallerInterface } from './NativeETInstaller';
2
+ declare const ETInstallerNativeModule: ETInstallerInterface;
3
+ export { ETInstallerNativeModule };
@@ -0,0 +1,16 @@
1
+ import { Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'react-native-executorch' doesn't seem to be linked. Make sure: \n\n` +
3
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
4
+ '- You rebuilt the app after installing the package\n' +
5
+ '- You are not using Expo Go\n';
6
+ function returnSpecOrThrowLinkingError(spec) {
7
+ return spec
8
+ ? spec
9
+ : new Proxy({}, {
10
+ get() {
11
+ throw new Error(LINKING_ERROR);
12
+ },
13
+ });
14
+ }
15
+ const ETInstallerNativeModule = returnSpecOrThrowLinkingError(require('./NativeETInstaller').default);
16
+ export { ETInstallerNativeModule };
@@ -0,0 +1,31 @@
1
+ export type ResourceSource = string | number | object;
2
+ export declare enum ScalarType {
3
+ BYTE = 0,
4
+ CHAR = 1,
5
+ SHORT = 2,
6
+ INT = 3,
7
+ LONG = 4,
8
+ HALF = 5,
9
+ FLOAT = 6,
10
+ DOUBLE = 7,
11
+ BOOL = 11,
12
+ QINT8 = 12,
13
+ QUINT8 = 13,
14
+ QINT32 = 14,
15
+ QUINT4X2 = 16,
16
+ QUINT2X4 = 17,
17
+ BITS16 = 22,
18
+ FLOAT8E5M2 = 23,
19
+ FLOAT8E4M3FN = 24,
20
+ FLOAT8E5M2FNUZ = 25,
21
+ FLOAT8E4M3FNUZ = 26,
22
+ UINT16 = 27,
23
+ UINT32 = 28,
24
+ UINT64 = 29
25
+ }
26
+ export type TensorBuffer = ArrayBuffer | Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | BigInt64Array | BigUint64Array;
27
+ export interface TensorPtr {
28
+ dataPtr: TensorBuffer;
29
+ sizes: number[];
30
+ scalarType: ScalarType;
31
+ }
@@ -0,0 +1,25 @@
1
+ export var ScalarType;
2
+ (function (ScalarType) {
3
+ ScalarType[ScalarType["BYTE"] = 0] = "BYTE";
4
+ ScalarType[ScalarType["CHAR"] = 1] = "CHAR";
5
+ ScalarType[ScalarType["SHORT"] = 2] = "SHORT";
6
+ ScalarType[ScalarType["INT"] = 3] = "INT";
7
+ ScalarType[ScalarType["LONG"] = 4] = "LONG";
8
+ ScalarType[ScalarType["HALF"] = 5] = "HALF";
9
+ ScalarType[ScalarType["FLOAT"] = 6] = "FLOAT";
10
+ ScalarType[ScalarType["DOUBLE"] = 7] = "DOUBLE";
11
+ ScalarType[ScalarType["BOOL"] = 11] = "BOOL";
12
+ ScalarType[ScalarType["QINT8"] = 12] = "QINT8";
13
+ ScalarType[ScalarType["QUINT8"] = 13] = "QUINT8";
14
+ ScalarType[ScalarType["QINT32"] = 14] = "QINT32";
15
+ ScalarType[ScalarType["QUINT4X2"] = 16] = "QUINT4X2";
16
+ ScalarType[ScalarType["QUINT2X4"] = 17] = "QUINT2X4";
17
+ ScalarType[ScalarType["BITS16"] = 22] = "BITS16";
18
+ ScalarType[ScalarType["FLOAT8E5M2"] = 23] = "FLOAT8E5M2";
19
+ ScalarType[ScalarType["FLOAT8E4M3FN"] = 24] = "FLOAT8E4M3FN";
20
+ ScalarType[ScalarType["FLOAT8E5M2FNUZ"] = 25] = "FLOAT8E5M2FNUZ";
21
+ ScalarType[ScalarType["FLOAT8E4M3FNUZ"] = 26] = "FLOAT8E4M3FNUZ";
22
+ ScalarType[ScalarType["UINT16"] = 27] = "UINT16";
23
+ ScalarType[ScalarType["UINT32"] = 28] = "UINT32";
24
+ ScalarType[ScalarType["UINT64"] = 29] = "UINT64";
25
+ })(ScalarType || (ScalarType = {}));
@@ -0,0 +1,24 @@
1
+ export declare enum DeeplabLabel {
2
+ BACKGROUND = 0,
3
+ AEROPLANE = 1,
4
+ BICYCLE = 2,
5
+ BIRD = 3,
6
+ BOAT = 4,
7
+ BOTTLE = 5,
8
+ BUS = 6,
9
+ CAR = 7,
10
+ CAT = 8,
11
+ CHAIR = 9,
12
+ COW = 10,
13
+ DININGTABLE = 11,
14
+ DOG = 12,
15
+ HORSE = 13,
16
+ MOTORBIKE = 14,
17
+ PERSON = 15,
18
+ POTTEDPLANT = 16,
19
+ SHEEP = 17,
20
+ SOFA = 18,
21
+ TRAIN = 19,
22
+ TVMONITOR = 20,
23
+ ARGMAX = 21
24
+ }
@@ -0,0 +1,26 @@
1
+ /* eslint-disable @cspell/spellchecker */
2
+ export var DeeplabLabel;
3
+ (function (DeeplabLabel) {
4
+ DeeplabLabel[DeeplabLabel["BACKGROUND"] = 0] = "BACKGROUND";
5
+ DeeplabLabel[DeeplabLabel["AEROPLANE"] = 1] = "AEROPLANE";
6
+ DeeplabLabel[DeeplabLabel["BICYCLE"] = 2] = "BICYCLE";
7
+ DeeplabLabel[DeeplabLabel["BIRD"] = 3] = "BIRD";
8
+ DeeplabLabel[DeeplabLabel["BOAT"] = 4] = "BOAT";
9
+ DeeplabLabel[DeeplabLabel["BOTTLE"] = 5] = "BOTTLE";
10
+ DeeplabLabel[DeeplabLabel["BUS"] = 6] = "BUS";
11
+ DeeplabLabel[DeeplabLabel["CAR"] = 7] = "CAR";
12
+ DeeplabLabel[DeeplabLabel["CAT"] = 8] = "CAT";
13
+ DeeplabLabel[DeeplabLabel["CHAIR"] = 9] = "CHAIR";
14
+ DeeplabLabel[DeeplabLabel["COW"] = 10] = "COW";
15
+ DeeplabLabel[DeeplabLabel["DININGTABLE"] = 11] = "DININGTABLE";
16
+ DeeplabLabel[DeeplabLabel["DOG"] = 12] = "DOG";
17
+ DeeplabLabel[DeeplabLabel["HORSE"] = 13] = "HORSE";
18
+ DeeplabLabel[DeeplabLabel["MOTORBIKE"] = 14] = "MOTORBIKE";
19
+ DeeplabLabel[DeeplabLabel["PERSON"] = 15] = "PERSON";
20
+ DeeplabLabel[DeeplabLabel["POTTEDPLANT"] = 16] = "POTTEDPLANT";
21
+ DeeplabLabel[DeeplabLabel["SHEEP"] = 17] = "SHEEP";
22
+ DeeplabLabel[DeeplabLabel["SOFA"] = 18] = "SOFA";
23
+ DeeplabLabel[DeeplabLabel["TRAIN"] = 19] = "TRAIN";
24
+ DeeplabLabel[DeeplabLabel["TVMONITOR"] = 20] = "TVMONITOR";
25
+ DeeplabLabel[DeeplabLabel["ARGMAX"] = 21] = "ARGMAX";
26
+ })(DeeplabLabel || (DeeplabLabel = {}));
@@ -0,0 +1,46 @@
1
+ export interface LLMType {
2
+ messageHistory: Message[];
3
+ response: string;
4
+ token: string;
5
+ isReady: boolean;
6
+ isGenerating: boolean;
7
+ downloadProgress: number;
8
+ error: string | null;
9
+ configure: ({ chatConfig, toolsConfig, }: {
10
+ chatConfig?: Partial<ChatConfig>;
11
+ toolsConfig?: ToolsConfig;
12
+ }) => void;
13
+ generate: (messages: Message[], tools?: LLMTool[]) => Promise<void>;
14
+ sendMessage: (message: string) => Promise<void>;
15
+ deleteMessage: (index: number) => void;
16
+ interrupt: () => void;
17
+ }
18
+ export type MessageRole = 'user' | 'assistant' | 'system';
19
+ export interface Message {
20
+ role: MessageRole;
21
+ content: string;
22
+ }
23
+ export interface ToolCall {
24
+ toolName: string;
25
+ arguments: Object;
26
+ }
27
+ export type LLMTool = Object;
28
+ export interface ChatConfig {
29
+ initialMessageHistory: Message[];
30
+ contextWindowLength: number;
31
+ systemPrompt: string;
32
+ }
33
+ export interface ToolsConfig {
34
+ tools: LLMTool[];
35
+ executeToolCallback: (call: ToolCall) => Promise<string | null>;
36
+ displayToolCalls?: boolean;
37
+ }
38
+ export declare const SPECIAL_TOKENS: {
39
+ BOS_TOKEN: string;
40
+ EOS_TOKEN: string;
41
+ UNK_TOKEN: string;
42
+ SEP_TOKEN: string;
43
+ PAD_TOKEN: string;
44
+ CLS_TOKEN: string;
45
+ MASK_TOKEN: string;
46
+ };
@@ -0,0 +1,9 @@
1
+ export const SPECIAL_TOKENS = {
2
+ BOS_TOKEN: 'bos_token',
3
+ EOS_TOKEN: 'eos_token',
4
+ UNK_TOKEN: 'unk_token',
5
+ SEP_TOKEN: 'sep_token',
6
+ PAD_TOKEN: 'pad_token',
7
+ CLS_TOKEN: 'cls_token',
8
+ MASK_TOKEN: 'mask_token',
9
+ };
@@ -0,0 +1,104 @@
1
+ export interface Bbox {
2
+ x1: number;
3
+ x2: number;
4
+ y1: number;
5
+ y2: number;
6
+ }
7
+ export interface Detection {
8
+ bbox: Bbox;
9
+ label: keyof typeof CocoLabel;
10
+ score: number;
11
+ }
12
+ declare enum CocoLabel {
13
+ PERSON = 1,
14
+ BICYCLE = 2,
15
+ CAR = 3,
16
+ MOTORCYCLE = 4,
17
+ AIRPLANE = 5,
18
+ BUS = 6,
19
+ TRAIN = 7,
20
+ TRUCK = 8,
21
+ BOAT = 9,
22
+ TRAFFIC_LIGHT = 10,
23
+ FIRE_HYDRANT = 11,
24
+ STREET_SIGN = 12,
25
+ STOP_SIGN = 13,
26
+ PARKING = 14,
27
+ BENCH = 15,
28
+ BIRD = 16,
29
+ CAT = 17,
30
+ DOG = 18,
31
+ HORSE = 19,
32
+ SHEEP = 20,
33
+ COW = 21,
34
+ ELEPHANT = 22,
35
+ BEAR = 23,
36
+ ZEBRA = 24,
37
+ GIRAFFE = 25,
38
+ HAT = 26,
39
+ BACKPACK = 27,
40
+ UMBRELLA = 28,
41
+ SHOE = 29,
42
+ EYE = 30,
43
+ HANDBAG = 31,
44
+ TIE = 32,
45
+ SUITCASE = 33,
46
+ FRISBEE = 34,
47
+ SKIS = 35,
48
+ SNOWBOARD = 36,
49
+ SPORTS = 37,
50
+ KITE = 38,
51
+ BASEBALL = 39,
52
+ SKATEBOARD = 41,
53
+ SURFBOARD = 42,
54
+ TENNIS_RACKET = 43,
55
+ BOTTLE = 44,
56
+ PLATE = 45,
57
+ WINE_GLASS = 46,
58
+ CUP = 47,
59
+ FORK = 48,
60
+ KNIFE = 49,
61
+ SPOON = 50,
62
+ BOWL = 51,
63
+ BANANA = 52,
64
+ APPLE = 53,
65
+ SANDWICH = 54,
66
+ ORANGE = 55,
67
+ BROCCOLI = 56,
68
+ CARROT = 57,
69
+ HOT_DOG = 58,
70
+ PIZZA = 59,
71
+ DONUT = 60,
72
+ CAKE = 61,
73
+ CHAIR = 62,
74
+ COUCH = 63,
75
+ POTTED_PLANT = 64,
76
+ BED = 65,
77
+ MIRROR = 66,
78
+ DINING_TABLE = 67,
79
+ WINDOW = 68,
80
+ DESK = 69,
81
+ TOILET = 70,
82
+ DOOR = 71,
83
+ TV = 72,
84
+ LAPTOP = 73,
85
+ MOUSE = 74,
86
+ REMOTE = 75,
87
+ KEYBOARD = 76,
88
+ CELL_PHONE = 77,
89
+ MICROWAVE = 78,
90
+ OVEN = 79,
91
+ TOASTER = 80,
92
+ SINK = 81,
93
+ REFRIGERATOR = 82,
94
+ BLENDER = 83,
95
+ BOOK = 84,
96
+ CLOCK = 85,
97
+ VASE = 86,
98
+ SCISSORS = 87,
99
+ TEDDY_BEAR = 88,
100
+ HAIR_DRIER = 89,
101
+ TOOTHBRUSH = 90,
102
+ HAIR_BRUSH = 91
103
+ }
104
+ export {};
@@ -0,0 +1,94 @@
1
+ var CocoLabel;
2
+ (function (CocoLabel) {
3
+ CocoLabel[CocoLabel["PERSON"] = 1] = "PERSON";
4
+ CocoLabel[CocoLabel["BICYCLE"] = 2] = "BICYCLE";
5
+ CocoLabel[CocoLabel["CAR"] = 3] = "CAR";
6
+ CocoLabel[CocoLabel["MOTORCYCLE"] = 4] = "MOTORCYCLE";
7
+ CocoLabel[CocoLabel["AIRPLANE"] = 5] = "AIRPLANE";
8
+ CocoLabel[CocoLabel["BUS"] = 6] = "BUS";
9
+ CocoLabel[CocoLabel["TRAIN"] = 7] = "TRAIN";
10
+ CocoLabel[CocoLabel["TRUCK"] = 8] = "TRUCK";
11
+ CocoLabel[CocoLabel["BOAT"] = 9] = "BOAT";
12
+ CocoLabel[CocoLabel["TRAFFIC_LIGHT"] = 10] = "TRAFFIC_LIGHT";
13
+ CocoLabel[CocoLabel["FIRE_HYDRANT"] = 11] = "FIRE_HYDRANT";
14
+ CocoLabel[CocoLabel["STREET_SIGN"] = 12] = "STREET_SIGN";
15
+ CocoLabel[CocoLabel["STOP_SIGN"] = 13] = "STOP_SIGN";
16
+ CocoLabel[CocoLabel["PARKING"] = 14] = "PARKING";
17
+ CocoLabel[CocoLabel["BENCH"] = 15] = "BENCH";
18
+ CocoLabel[CocoLabel["BIRD"] = 16] = "BIRD";
19
+ CocoLabel[CocoLabel["CAT"] = 17] = "CAT";
20
+ CocoLabel[CocoLabel["DOG"] = 18] = "DOG";
21
+ CocoLabel[CocoLabel["HORSE"] = 19] = "HORSE";
22
+ CocoLabel[CocoLabel["SHEEP"] = 20] = "SHEEP";
23
+ CocoLabel[CocoLabel["COW"] = 21] = "COW";
24
+ CocoLabel[CocoLabel["ELEPHANT"] = 22] = "ELEPHANT";
25
+ CocoLabel[CocoLabel["BEAR"] = 23] = "BEAR";
26
+ CocoLabel[CocoLabel["ZEBRA"] = 24] = "ZEBRA";
27
+ CocoLabel[CocoLabel["GIRAFFE"] = 25] = "GIRAFFE";
28
+ CocoLabel[CocoLabel["HAT"] = 26] = "HAT";
29
+ CocoLabel[CocoLabel["BACKPACK"] = 27] = "BACKPACK";
30
+ CocoLabel[CocoLabel["UMBRELLA"] = 28] = "UMBRELLA";
31
+ CocoLabel[CocoLabel["SHOE"] = 29] = "SHOE";
32
+ CocoLabel[CocoLabel["EYE"] = 30] = "EYE";
33
+ CocoLabel[CocoLabel["HANDBAG"] = 31] = "HANDBAG";
34
+ CocoLabel[CocoLabel["TIE"] = 32] = "TIE";
35
+ CocoLabel[CocoLabel["SUITCASE"] = 33] = "SUITCASE";
36
+ CocoLabel[CocoLabel["FRISBEE"] = 34] = "FRISBEE";
37
+ CocoLabel[CocoLabel["SKIS"] = 35] = "SKIS";
38
+ CocoLabel[CocoLabel["SNOWBOARD"] = 36] = "SNOWBOARD";
39
+ CocoLabel[CocoLabel["SPORTS"] = 37] = "SPORTS";
40
+ CocoLabel[CocoLabel["KITE"] = 38] = "KITE";
41
+ CocoLabel[CocoLabel["BASEBALL"] = 39] = "BASEBALL";
42
+ CocoLabel[CocoLabel["SKATEBOARD"] = 41] = "SKATEBOARD";
43
+ CocoLabel[CocoLabel["SURFBOARD"] = 42] = "SURFBOARD";
44
+ CocoLabel[CocoLabel["TENNIS_RACKET"] = 43] = "TENNIS_RACKET";
45
+ CocoLabel[CocoLabel["BOTTLE"] = 44] = "BOTTLE";
46
+ CocoLabel[CocoLabel["PLATE"] = 45] = "PLATE";
47
+ CocoLabel[CocoLabel["WINE_GLASS"] = 46] = "WINE_GLASS";
48
+ CocoLabel[CocoLabel["CUP"] = 47] = "CUP";
49
+ CocoLabel[CocoLabel["FORK"] = 48] = "FORK";
50
+ CocoLabel[CocoLabel["KNIFE"] = 49] = "KNIFE";
51
+ CocoLabel[CocoLabel["SPOON"] = 50] = "SPOON";
52
+ CocoLabel[CocoLabel["BOWL"] = 51] = "BOWL";
53
+ CocoLabel[CocoLabel["BANANA"] = 52] = "BANANA";
54
+ CocoLabel[CocoLabel["APPLE"] = 53] = "APPLE";
55
+ CocoLabel[CocoLabel["SANDWICH"] = 54] = "SANDWICH";
56
+ CocoLabel[CocoLabel["ORANGE"] = 55] = "ORANGE";
57
+ CocoLabel[CocoLabel["BROCCOLI"] = 56] = "BROCCOLI";
58
+ CocoLabel[CocoLabel["CARROT"] = 57] = "CARROT";
59
+ CocoLabel[CocoLabel["HOT_DOG"] = 58] = "HOT_DOG";
60
+ CocoLabel[CocoLabel["PIZZA"] = 59] = "PIZZA";
61
+ CocoLabel[CocoLabel["DONUT"] = 60] = "DONUT";
62
+ CocoLabel[CocoLabel["CAKE"] = 61] = "CAKE";
63
+ CocoLabel[CocoLabel["CHAIR"] = 62] = "CHAIR";
64
+ CocoLabel[CocoLabel["COUCH"] = 63] = "COUCH";
65
+ CocoLabel[CocoLabel["POTTED_PLANT"] = 64] = "POTTED_PLANT";
66
+ CocoLabel[CocoLabel["BED"] = 65] = "BED";
67
+ CocoLabel[CocoLabel["MIRROR"] = 66] = "MIRROR";
68
+ CocoLabel[CocoLabel["DINING_TABLE"] = 67] = "DINING_TABLE";
69
+ CocoLabel[CocoLabel["WINDOW"] = 68] = "WINDOW";
70
+ CocoLabel[CocoLabel["DESK"] = 69] = "DESK";
71
+ CocoLabel[CocoLabel["TOILET"] = 70] = "TOILET";
72
+ CocoLabel[CocoLabel["DOOR"] = 71] = "DOOR";
73
+ CocoLabel[CocoLabel["TV"] = 72] = "TV";
74
+ CocoLabel[CocoLabel["LAPTOP"] = 73] = "LAPTOP";
75
+ CocoLabel[CocoLabel["MOUSE"] = 74] = "MOUSE";
76
+ CocoLabel[CocoLabel["REMOTE"] = 75] = "REMOTE";
77
+ CocoLabel[CocoLabel["KEYBOARD"] = 76] = "KEYBOARD";
78
+ CocoLabel[CocoLabel["CELL_PHONE"] = 77] = "CELL_PHONE";
79
+ CocoLabel[CocoLabel["MICROWAVE"] = 78] = "MICROWAVE";
80
+ CocoLabel[CocoLabel["OVEN"] = 79] = "OVEN";
81
+ CocoLabel[CocoLabel["TOASTER"] = 80] = "TOASTER";
82
+ CocoLabel[CocoLabel["SINK"] = 81] = "SINK";
83
+ CocoLabel[CocoLabel["REFRIGERATOR"] = 82] = "REFRIGERATOR";
84
+ CocoLabel[CocoLabel["BLENDER"] = 83] = "BLENDER";
85
+ CocoLabel[CocoLabel["BOOK"] = 84] = "BOOK";
86
+ CocoLabel[CocoLabel["CLOCK"] = 85] = "CLOCK";
87
+ CocoLabel[CocoLabel["VASE"] = 86] = "VASE";
88
+ CocoLabel[CocoLabel["SCISSORS"] = 87] = "SCISSORS";
89
+ CocoLabel[CocoLabel["TEDDY_BEAR"] = 88] = "TEDDY_BEAR";
90
+ CocoLabel[CocoLabel["HAIR_DRIER"] = 89] = "HAIR_DRIER";
91
+ CocoLabel[CocoLabel["TOOTHBRUSH"] = 90] = "TOOTHBRUSH";
92
+ CocoLabel[CocoLabel["HAIR_BRUSH"] = 91] = "HAIR_BRUSH";
93
+ })(CocoLabel || (CocoLabel = {}));
94
+ export {};
@@ -0,0 +1,11 @@
1
+ import { symbols } from '../constants/ocr/symbols';
2
+ export interface OCRDetection {
3
+ bbox: OCRBbox[];
4
+ text: string;
5
+ score: number;
6
+ }
7
+ export interface OCRBbox {
8
+ x: number;
9
+ y: number;
10
+ }
11
+ export type OCRLanguage = keyof typeof symbols;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,94 @@
1
+ export interface ModelConfig {
2
+ sources: {
3
+ encoder: string;
4
+ decoder: string;
5
+ };
6
+ tokenizer: {
7
+ source: string;
8
+ bos: number;
9
+ eos: number;
10
+ };
11
+ isMultilingual: boolean;
12
+ }
13
+ export declare enum SpeechToTextLanguage {
14
+ Afrikaans = "af",
15
+ Albanian = "sq",
16
+ Arabic = "ar",
17
+ Armenian = "hy",
18
+ Azerbaijani = "az",
19
+ Basque = "eu",
20
+ Belarusian = "be",
21
+ Bengali = "bn",
22
+ Bosnian = "bs",
23
+ Bulgarian = "bg",
24
+ Burmese = "my",
25
+ Catalan = "ca",
26
+ Chinese = "zh",
27
+ Croatian = "hr",
28
+ Czech = "cs",
29
+ Danish = "da",
30
+ Dutch = "nl",
31
+ Estonian = "et",
32
+ English = "en",
33
+ Finnish = "fi",
34
+ French = "fr",
35
+ Galician = "gl",
36
+ Georgian = "ka",
37
+ German = "de",
38
+ Greek = "el",
39
+ Gujarati = "gu",
40
+ HaitianCreole = "ht",
41
+ Hebrew = "he",
42
+ Hindi = "hi",
43
+ Hungarian = "hu",
44
+ Icelandic = "is",
45
+ Indonesian = "id",
46
+ Italian = "it",
47
+ Japanese = "ja",
48
+ Kannada = "kn",
49
+ Kazakh = "kk",
50
+ Khmer = "km",
51
+ Korean = "ko",
52
+ Lao = "lo",
53
+ Latvian = "lv",
54
+ Lithuanian = "lt",
55
+ Macedonian = "mk",
56
+ Malagasy = "mg",
57
+ Malay = "ms",
58
+ Malayalam = "ml",
59
+ Maltese = "mt",
60
+ Marathi = "mr",
61
+ Nepali = "ne",
62
+ Norwegian = "no",
63
+ Persian = "fa",
64
+ Polish = "pl",
65
+ Portuguese = "pt",
66
+ Punjabi = "pa",
67
+ Romanian = "ro",
68
+ Russian = "ru",
69
+ Serbian = "sr",
70
+ Sinhala = "si",
71
+ Slovak = "sk",
72
+ Slovenian = "sl",
73
+ Spanish = "es",
74
+ Sundanese = "su",
75
+ Swahili = "sw",
76
+ Swedish = "sv",
77
+ Tagalog = "tl",
78
+ Tajik = "tg",
79
+ Tamil = "ta",
80
+ Telugu = "te",
81
+ Thai = "th",
82
+ Turkish = "tr",
83
+ Ukrainian = "uk",
84
+ Urdu = "ur",
85
+ Uzbek = "uz",
86
+ Vietnamese = "vi",
87
+ Welsh = "cy",
88
+ Yiddish = "yi"
89
+ }
90
+ export declare enum AvailableModels {
91
+ WHISPER = "whisper",
92
+ MOONSHINE = "moonshine",
93
+ WHISPER_MULTILINGUAL = "whisperMultilingual"
94
+ }