@webex/ladon-ts 5.4.1 → 5.4.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.
- package/CHANGELOG.md +170 -163
- package/LICENSE +5 -5
- package/README.md +34 -36
- package/build/module/index.d.ts +10 -10
- package/build/module/lib/config-builder.d.ts +179 -180
- package/build/module/lib/config-types.d.ts +101 -101
- package/build/module/lib/config.d.ts +28 -29
- package/build/module/lib/generator.d.ts +73 -74
- package/build/module/lib/pipeline.d.ts +82 -83
- package/build/module/lib/preload.d.ts +7 -8
- package/build/module/lib/renderer/blur-renderer.d.ts +17 -18
- package/build/module/lib/renderer/ladon-renderer.d.ts +5 -6
- package/build/module/lib/renderer/passthrough-renderer.d.ts +10 -11
- package/build/module/lib/renderer/replacement-renderer.d.ts +14 -15
- package/build/module/lib/renderer/webgl-renderer.d.ts +23 -24
- package/build/module/lib/renderer.d.ts +5 -5
- package/build/module/lib/shared-resource-manager.d.ts +92 -92
- package/build/module/lib/util.d.ts +64 -64
- package/build/module/lib/version.d.ts +1 -1
- package/build/module/lib/version.js +1 -1
- package/build/module/lib/version.js.map +1 -1
- package/build/worker/ort-wasm-simd-threaded.wasm +0 -0
- package/build/worker/segmentation.js.map +1 -0
- package/package.json +101 -95
|
@@ -1,181 +1,180 @@
|
|
|
1
1
|
import { AssetUrlResolver, BlurConfig, BlurStrength, Generator, InputConfig, MaskConfig, PassthroughConfig, PipelineConfig, PreloadConfig, Quality, RenderConfig } from './config-types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
* @param
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
* @param
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
* @param
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
* @param
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* @param
|
|
164
|
-
* @
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*
|
|
170
|
-
* @param
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
static
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
2
|
+
/**
|
|
3
|
+
* A builder class for creating PipelineConfig instances in a flexible and intuitive way.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConfigurationBuilder {
|
|
6
|
+
private env;
|
|
7
|
+
private config;
|
|
8
|
+
constructor(env?: 'int' | 'prod');
|
|
9
|
+
/**
|
|
10
|
+
* Sets the base URL for the configuration.
|
|
11
|
+
* @param baseUrl The base URL to use.
|
|
12
|
+
*/
|
|
13
|
+
setBaseUrl(baseUrl: string): ConfigurationBuilder;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the WASM URI for the configuration.
|
|
16
|
+
* @param wasmUri The WASM URI to use.
|
|
17
|
+
*/
|
|
18
|
+
setWasmUri(wasmUri: string): ConfigurationBuilder;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the asset URL resolver.
|
|
21
|
+
* @param assetUrlResolver The asset URL resolver to use
|
|
22
|
+
* @returns The current ConfigurationBuilder instance.
|
|
23
|
+
*/
|
|
24
|
+
setAssetUrlResolver(assetUrlResolver: AssetUrlResolver): ConfigurationBuilder;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the execution providers for the ONNX runtime.
|
|
27
|
+
*
|
|
28
|
+
* @param executionProviders The execution providers to use.
|
|
29
|
+
*/
|
|
30
|
+
setExecutionProviders(executionProviders: string[]): ConfigurationBuilder;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the input size for the configuration.
|
|
33
|
+
* @param height The height of the input.
|
|
34
|
+
* @param width The width of the input.
|
|
35
|
+
*/
|
|
36
|
+
setInputSize(height: number, width: number): ConfigurationBuilder;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the input configuration.
|
|
39
|
+
* @param inputConfig The input configuration to use.
|
|
40
|
+
*/
|
|
41
|
+
setInputConfig(inputConfig: InputConfig): ConfigurationBuilder;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the render configuration.
|
|
44
|
+
* @param renderConfig The render configuration to use.
|
|
45
|
+
*/
|
|
46
|
+
setRenderConfig(renderConfig: RenderConfig): ConfigurationBuilder;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the render type.
|
|
49
|
+
* @param type The render type ('blur', 'passthrough', 'replacement').
|
|
50
|
+
*/
|
|
51
|
+
setRenderType(type: 'blur' | 'passthrough' | 'replacement'): ConfigurationBuilder;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the horizontal mirror property for the render configuration.
|
|
54
|
+
* @param horizontalMirror Boolean indicating if horizontal mirror should be applied.
|
|
55
|
+
*/
|
|
56
|
+
setRenderHorizontalMirror(horizontalMirror: boolean): ConfigurationBuilder;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the blur strength for the render configuration.
|
|
59
|
+
* @param blurStrength The blur strength to use.
|
|
60
|
+
*/
|
|
61
|
+
setBlurStrength(blurStrength: BlurStrength): ConfigurationBuilder;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the blur kernel size.
|
|
64
|
+
* @param kernelSize The kernel size for the blur effect.
|
|
65
|
+
*/
|
|
66
|
+
setBlurKernelSize(kernelSize: number): ConfigurationBuilder;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the blur sigma value.
|
|
69
|
+
* @param sigma The sigma value for the blur effect.
|
|
70
|
+
*/
|
|
71
|
+
setBlurSigma(sigma: number): ConfigurationBuilder;
|
|
72
|
+
/**
|
|
73
|
+
* Sets the replacement background.
|
|
74
|
+
* @param background The background to use for replacement.
|
|
75
|
+
*/
|
|
76
|
+
setReplacementBackground(background: HTMLCanvasElement): ConfigurationBuilder;
|
|
77
|
+
/**
|
|
78
|
+
* Sets the replacement static property.
|
|
79
|
+
* @param isStatic Boolean indicating if the replacement is static.
|
|
80
|
+
*/
|
|
81
|
+
setReplacementStatic(isStatic: boolean): ConfigurationBuilder;
|
|
82
|
+
/**
|
|
83
|
+
* Sets the mask configuration.
|
|
84
|
+
* @param maskConfig The mask configuration to use.
|
|
85
|
+
*/
|
|
86
|
+
setMaskConfig(maskConfig: MaskConfig): ConfigurationBuilder;
|
|
87
|
+
/**
|
|
88
|
+
* Sets the mask generator.
|
|
89
|
+
* @param generator The generator type ('local' or 'worker').
|
|
90
|
+
*/
|
|
91
|
+
setMaskGenerator(generator: Generator): ConfigurationBuilder;
|
|
92
|
+
/**
|
|
93
|
+
* Sets the mask generation interval in milliseconds.
|
|
94
|
+
* @param intervalMs The generation interval in milliseconds.
|
|
95
|
+
*/
|
|
96
|
+
setMaskGenerationIntervalMs(intervalMs: number): ConfigurationBuilder;
|
|
97
|
+
/**
|
|
98
|
+
* Sets the mask model rank.
|
|
99
|
+
* @param modelRank The model rank to use.
|
|
100
|
+
*/
|
|
101
|
+
setMaskModelRank(modelRank: number): ConfigurationBuilder;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the mask model URI.
|
|
104
|
+
* @param modelUri The model URI to use.
|
|
105
|
+
*/
|
|
106
|
+
setMaskModelUri(modelUri: string): ConfigurationBuilder;
|
|
107
|
+
/**
|
|
108
|
+
* Sets the mask worker URI.
|
|
109
|
+
* @param workerUri The worker URI to use.
|
|
110
|
+
*/
|
|
111
|
+
setMaskWorkerUri(workerUri: string): ConfigurationBuilder;
|
|
112
|
+
/**
|
|
113
|
+
* Sets the mask input size.
|
|
114
|
+
* @param height The height of the mask input.
|
|
115
|
+
* @param width The width of the mask input.
|
|
116
|
+
*/
|
|
117
|
+
setMaskInputSize(height: number, width: number): ConfigurationBuilder;
|
|
118
|
+
/**
|
|
119
|
+
* Sets the mask output size.
|
|
120
|
+
* @param height The height of the mask output.
|
|
121
|
+
* @param width The width of the mask output.
|
|
122
|
+
*/
|
|
123
|
+
setMaskOutputSize(height: number, width: number): ConfigurationBuilder;
|
|
124
|
+
/**
|
|
125
|
+
* Sets the mask upscaled size.
|
|
126
|
+
* @param height The height of the upscaled mask.
|
|
127
|
+
* @param width The width of the upscaled mask.
|
|
128
|
+
*/
|
|
129
|
+
setMaskUpscaleSize(height: number, width: number): ConfigurationBuilder;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the quality level and updates mask configurations accordingly.
|
|
132
|
+
* @param quality The desired quality level.
|
|
133
|
+
*/
|
|
134
|
+
setMaskQuality(quality: Quality): ConfigurationBuilder;
|
|
135
|
+
/**
|
|
136
|
+
* Builds and returns the PreloadConfig or PipelineConfig object.
|
|
137
|
+
*
|
|
138
|
+
* @param requireInputConfig Whether to require the input configuration to be set before building.
|
|
139
|
+
* Input size is not available at preload so this needs to be optional. The default value is true.
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
build(requireInputConfig?: boolean): PipelineConfig | PreloadConfig;
|
|
143
|
+
/**
|
|
144
|
+
* Returns the mask configuration, initializing it if necessary.
|
|
145
|
+
*/
|
|
146
|
+
private getMaskConfig;
|
|
147
|
+
/**
|
|
148
|
+
* Returns the base URL for the configuration.
|
|
149
|
+
*/
|
|
150
|
+
resolveBaseUrl(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Returns the base URL for the configuration.
|
|
153
|
+
*
|
|
154
|
+
* @returns The base URL for the configuration.
|
|
155
|
+
*/
|
|
156
|
+
resolveModelUri(): string;
|
|
157
|
+
resolveWasmUri(): string;
|
|
158
|
+
resolveWorkerUri(): string;
|
|
159
|
+
/**
|
|
160
|
+
* Resolves a template string with the specified values.
|
|
161
|
+
*
|
|
162
|
+
* @param template The template string to resolve.
|
|
163
|
+
* @param values The values to use for resolution.
|
|
164
|
+
* @returns The resolved template string.
|
|
165
|
+
*/
|
|
166
|
+
private resolveTemplate;
|
|
167
|
+
/**
|
|
168
|
+
* Generates a blur configuration based on the specified blur strength.
|
|
169
|
+
* @param blurStrength The desired blur strength.
|
|
170
|
+
* @param horizontalMirror Whether to apply horizontal mirroring.
|
|
171
|
+
*/
|
|
172
|
+
static getBlurConfig(blurStrength: BlurStrength, horizontalMirror?: boolean): BlurConfig;
|
|
173
|
+
static getPassthroughConfig(horizontalMirror?: boolean): PassthroughConfig;
|
|
174
|
+
/**
|
|
175
|
+
* Returns the library version.
|
|
176
|
+
*
|
|
177
|
+
* @returns The library version.
|
|
178
|
+
*/
|
|
179
|
+
static getLibVersion(): string;
|
|
180
|
+
}
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
export declare enum Quality {
|
|
2
|
-
TINY = "TINY",
|
|
3
|
-
LOW = "LOW",
|
|
4
|
-
MEDIUM = "MEDIUM",
|
|
5
|
-
HIGH = "HIGH",
|
|
6
|
-
ULTRA = "ULTRA"
|
|
7
|
-
}
|
|
8
|
-
export declare enum BlurStrength {
|
|
9
|
-
WEAK = "WEAK",
|
|
10
|
-
MODERATE = "MODERATE",
|
|
11
|
-
STRONG = "STRONG",
|
|
12
|
-
STRONGER = "STRONGER",
|
|
13
|
-
STRONGEST = "STRONGEST"
|
|
14
|
-
}
|
|
15
|
-
export type ResolutionConfig = {
|
|
16
|
-
readonly height: number;
|
|
17
|
-
readonly width: number;
|
|
18
|
-
};
|
|
19
|
-
export interface SizeConfig {
|
|
20
|
-
readonly inputSize: ResolutionConfig;
|
|
21
|
-
readonly outputSize: ResolutionConfig;
|
|
22
|
-
readonly upscaleSize: ResolutionConfig;
|
|
23
|
-
}
|
|
24
|
-
export interface ModelQualityConfig {
|
|
25
|
-
readonly modelFile: string;
|
|
26
|
-
readonly modelRank: number;
|
|
27
|
-
readonly generationIntervalMs: number;
|
|
28
|
-
readonly inputSize: ResolutionConfig;
|
|
29
|
-
readonly outputSize: ResolutionConfig;
|
|
30
|
-
readonly upscaleSize: ResolutionConfig;
|
|
31
|
-
}
|
|
32
|
-
export type InputConfig = ResolutionConfig;
|
|
33
|
-
export type AssetUrlResolver = (assetUri: string, config: PreloadConfig) => Promise<string>;
|
|
34
|
-
export interface RenderConfig {
|
|
35
|
-
readonly type: 'blur' | 'passthrough' | 'replacement';
|
|
36
|
-
readonly horizontalMirror?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export interface BlurConfig extends RenderConfig {
|
|
39
|
-
readonly type: 'blur';
|
|
40
|
-
readonly kernelSize: number;
|
|
41
|
-
readonly sigma: number;
|
|
42
|
-
}
|
|
43
|
-
export interface ReplacementConfig extends RenderConfig {
|
|
44
|
-
readonly type: 'replacement';
|
|
45
|
-
readonly background: HTMLCanvasElement;
|
|
46
|
-
readonly static: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface PassthroughConfig extends RenderConfig {
|
|
49
|
-
readonly type: 'passthrough';
|
|
50
|
-
}
|
|
51
|
-
export type Generator = 'local' | 'worker';
|
|
52
|
-
export type BaseMaskConfig = {
|
|
53
|
-
readonly generator: Generator;
|
|
54
|
-
readonly generationIntervalMs: number;
|
|
55
|
-
readonly modelRank: number;
|
|
56
|
-
readonly modelUri: string;
|
|
57
|
-
readonly workerUri: string;
|
|
58
|
-
readonly inputSize?: ResolutionConfig;
|
|
59
|
-
readonly outputSize?: ResolutionConfig;
|
|
60
|
-
readonly upscaleSize?: ResolutionConfig;
|
|
61
|
-
};
|
|
62
|
-
export type MaskConfig = BaseMaskConfig & SizeConfig;
|
|
63
|
-
export type PreloadConfig = {
|
|
64
|
-
readonly baseUrl?: string;
|
|
65
|
-
readonly wasmUri: string;
|
|
66
|
-
readonly mask: BaseMaskConfig;
|
|
67
|
-
readonly executionProviders?: string[];
|
|
68
|
-
readonly assetUrlResolver?: AssetUrlResolver;
|
|
69
|
-
};
|
|
70
|
-
export type WorkerConfig = Omit<PreloadConfig, 'assetUrlResolver'>;
|
|
71
|
-
export type PipelineConfig = PreloadConfig & {
|
|
72
|
-
readonly render: BlurConfig | RenderConfig | ReplacementConfig;
|
|
73
|
-
readonly input: InputConfig;
|
|
74
|
-
readonly mask: MaskConfig;
|
|
75
|
-
};
|
|
76
|
-
export interface RawConfig {
|
|
77
|
-
readonly baseUrls: {
|
|
78
|
-
readonly int: string;
|
|
79
|
-
readonly prod: string;
|
|
80
|
-
};
|
|
81
|
-
readonly basePaths: {
|
|
82
|
-
readonly models: string;
|
|
83
|
-
readonly wasm: string;
|
|
84
|
-
readonly workers: string;
|
|
85
|
-
};
|
|
86
|
-
readonly blurStrengths: {
|
|
87
|
-
readonly [key in Lowercase<BlurStrength>]: {
|
|
88
|
-
readonly kernelSize: number;
|
|
89
|
-
readonly sigma: number;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
readonly modelQualities: {
|
|
93
|
-
readonly [key in Lowercase<Quality>]: ModelQualityConfig;
|
|
94
|
-
};
|
|
95
|
-
readonly onnxVersion: string;
|
|
96
|
-
readonly modelVersion: string;
|
|
97
|
-
readonly workerFile: string;
|
|
98
|
-
readonly modelUrlTemplate: string;
|
|
99
|
-
readonly wasmPathTemplate: string;
|
|
100
|
-
readonly workerUrlTemplate: string;
|
|
101
|
-
}
|
|
1
|
+
export declare enum Quality {
|
|
2
|
+
TINY = "TINY",
|
|
3
|
+
LOW = "LOW",
|
|
4
|
+
MEDIUM = "MEDIUM",
|
|
5
|
+
HIGH = "HIGH",
|
|
6
|
+
ULTRA = "ULTRA"
|
|
7
|
+
}
|
|
8
|
+
export declare enum BlurStrength {
|
|
9
|
+
WEAK = "WEAK",
|
|
10
|
+
MODERATE = "MODERATE",
|
|
11
|
+
STRONG = "STRONG",
|
|
12
|
+
STRONGER = "STRONGER",
|
|
13
|
+
STRONGEST = "STRONGEST"
|
|
14
|
+
}
|
|
15
|
+
export type ResolutionConfig = {
|
|
16
|
+
readonly height: number;
|
|
17
|
+
readonly width: number;
|
|
18
|
+
};
|
|
19
|
+
export interface SizeConfig {
|
|
20
|
+
readonly inputSize: ResolutionConfig;
|
|
21
|
+
readonly outputSize: ResolutionConfig;
|
|
22
|
+
readonly upscaleSize: ResolutionConfig;
|
|
23
|
+
}
|
|
24
|
+
export interface ModelQualityConfig {
|
|
25
|
+
readonly modelFile: string;
|
|
26
|
+
readonly modelRank: number;
|
|
27
|
+
readonly generationIntervalMs: number;
|
|
28
|
+
readonly inputSize: ResolutionConfig;
|
|
29
|
+
readonly outputSize: ResolutionConfig;
|
|
30
|
+
readonly upscaleSize: ResolutionConfig;
|
|
31
|
+
}
|
|
32
|
+
export type InputConfig = ResolutionConfig;
|
|
33
|
+
export type AssetUrlResolver = (assetUri: string, config: PreloadConfig) => Promise<string>;
|
|
34
|
+
export interface RenderConfig {
|
|
35
|
+
readonly type: 'blur' | 'passthrough' | 'replacement';
|
|
36
|
+
readonly horizontalMirror?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface BlurConfig extends RenderConfig {
|
|
39
|
+
readonly type: 'blur';
|
|
40
|
+
readonly kernelSize: number;
|
|
41
|
+
readonly sigma: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ReplacementConfig extends RenderConfig {
|
|
44
|
+
readonly type: 'replacement';
|
|
45
|
+
readonly background: HTMLCanvasElement;
|
|
46
|
+
readonly static: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface PassthroughConfig extends RenderConfig {
|
|
49
|
+
readonly type: 'passthrough';
|
|
50
|
+
}
|
|
51
|
+
export type Generator = 'local' | 'worker';
|
|
52
|
+
export type BaseMaskConfig = {
|
|
53
|
+
readonly generator: Generator;
|
|
54
|
+
readonly generationIntervalMs: number;
|
|
55
|
+
readonly modelRank: number;
|
|
56
|
+
readonly modelUri: string;
|
|
57
|
+
readonly workerUri: string;
|
|
58
|
+
readonly inputSize?: ResolutionConfig;
|
|
59
|
+
readonly outputSize?: ResolutionConfig;
|
|
60
|
+
readonly upscaleSize?: ResolutionConfig;
|
|
61
|
+
};
|
|
62
|
+
export type MaskConfig = BaseMaskConfig & SizeConfig;
|
|
63
|
+
export type PreloadConfig = {
|
|
64
|
+
readonly baseUrl?: string;
|
|
65
|
+
readonly wasmUri: string;
|
|
66
|
+
readonly mask: BaseMaskConfig;
|
|
67
|
+
readonly executionProviders?: string[];
|
|
68
|
+
readonly assetUrlResolver?: AssetUrlResolver;
|
|
69
|
+
};
|
|
70
|
+
export type WorkerConfig = Omit<PreloadConfig, 'assetUrlResolver'>;
|
|
71
|
+
export type PipelineConfig = PreloadConfig & {
|
|
72
|
+
readonly render: BlurConfig | RenderConfig | ReplacementConfig;
|
|
73
|
+
readonly input: InputConfig;
|
|
74
|
+
readonly mask: MaskConfig;
|
|
75
|
+
};
|
|
76
|
+
export interface RawConfig {
|
|
77
|
+
readonly baseUrls: {
|
|
78
|
+
readonly int: string;
|
|
79
|
+
readonly prod: string;
|
|
80
|
+
};
|
|
81
|
+
readonly basePaths: {
|
|
82
|
+
readonly models: string;
|
|
83
|
+
readonly wasm: string;
|
|
84
|
+
readonly workers: string;
|
|
85
|
+
};
|
|
86
|
+
readonly blurStrengths: {
|
|
87
|
+
readonly [key in Lowercase<BlurStrength>]: {
|
|
88
|
+
readonly kernelSize: number;
|
|
89
|
+
readonly sigma: number;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly modelQualities: {
|
|
93
|
+
readonly [key in Lowercase<Quality>]: ModelQualityConfig;
|
|
94
|
+
};
|
|
95
|
+
readonly onnxVersion: string;
|
|
96
|
+
readonly modelVersion: string;
|
|
97
|
+
readonly workerFile: string;
|
|
98
|
+
readonly modelUrlTemplate: string;
|
|
99
|
+
readonly wasmPathTemplate: string;
|
|
100
|
+
readonly workerUrlTemplate: string;
|
|
101
|
+
}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { AssetUrlResolver, BlurConfig, BlurStrength, Generator, PipelineConfig, PreloadConfig, Quality, RenderConfig, ReplacementConfig } from './config-types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* The
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export declare const getConfig: (height: number, width: number, quality: Quality, generator: Generator, renderConfig: BlurConfig | RenderConfig | ReplacementConfig, modelUrlResolver: AssetUrlResolver, baseUrl: string) => PipelineConfig;
|
|
2
|
+
/**
|
|
3
|
+
* Generates a blur configuration based on the specified blur strength.
|
|
4
|
+
* This function uses the static method from ConfigurationBuilder.
|
|
5
|
+
* @param blurStrength The desired blur strength.
|
|
6
|
+
* @param horizontalMirror Whether to apply horizontal mirroring.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getBlurConfig: (blurStrength: BlurStrength, horizontalMirror?: boolean) => BlurConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a PreloadConfig using the ConfigurationBuilder.
|
|
11
|
+
* The function preserves the old signature for compatibility.
|
|
12
|
+
* @param quality The desired model quality.
|
|
13
|
+
* @param generator The mask generator ('local' or 'worker').
|
|
14
|
+
* @param modelUrlResolver A function to resolve model URLs.
|
|
15
|
+
* @param baseUrl The base URL to use.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getPreloadConfig: (quality: Quality, generator: Generator, modelUrlResolver: AssetUrlResolver, baseUrl: string) => PreloadConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves a PipelineConfig using the ConfigurationBuilder.
|
|
20
|
+
* The function preserves the old signature for compatibility.
|
|
21
|
+
* @param height The height of the input size.
|
|
22
|
+
* @param width The width of the input size.
|
|
23
|
+
* @param quality The desired model quality.
|
|
24
|
+
* @param generator The mask generator ('local' or 'worker').
|
|
25
|
+
* @param renderConfig The render configuration (blur, replacement, etc.).
|
|
26
|
+
* @param modelUrlResolver A function to resolve model URLs.
|
|
27
|
+
* @param baseUrl The base URL to use.
|
|
28
|
+
*/
|
|
29
|
+
export declare const getConfig: (height: number, width: number, quality: Quality, generator: Generator, renderConfig: BlurConfig | RenderConfig | ReplacementConfig, modelUrlResolver: AssetUrlResolver, baseUrl: string) => PipelineConfig;
|