@desert-ant-labs/clear 0.1.2 → 0.1.4
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/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.js +3 -4
- package/package.json +2 -2
package/dist/index.browser.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface LoadOptions extends Partial<ClearEnv> {
|
|
|
26
26
|
onDownloadProgress?: DownloadProgress;
|
|
27
27
|
/** Compilation-phase notifications. */
|
|
28
28
|
onPhase?: (phase: "compiling-webgpu" | "compiling-wasm") => void;
|
|
29
|
+
/** Usage/telemetry key. Omit for keyless (the site Origin identifies usage). */
|
|
30
|
+
usageKey?: string;
|
|
29
31
|
}
|
|
30
32
|
/** Loads a variant from the Hugging Face Hub (cached in Cache Storage) and builds a session. */
|
|
31
33
|
export declare function load(options?: LoadOptions): Promise<ClearModel>;
|
package/dist/index.browser.js
CHANGED
|
@@ -23,12 +23,11 @@ export const env = {
|
|
|
23
23
|
allowRemote: true,
|
|
24
24
|
useCache: true,
|
|
25
25
|
};
|
|
26
|
-
const USAGE_KEY = "dal_lEL3EuFU2eh8IRTH8RW9pV9czYn0TrCk";
|
|
27
26
|
let usage = null;
|
|
28
|
-
function instrument(model) {
|
|
27
|
+
function instrument(model, usageKey) {
|
|
29
28
|
const enhance = model.enhance.bind(model);
|
|
30
29
|
model.enhance = async (pcm, options) => {
|
|
31
|
-
usage ??= initUsage({ key:
|
|
30
|
+
usage ??= initUsage({ key: usageKey });
|
|
32
31
|
const result = await enhance(pcm, options);
|
|
33
32
|
usage.recordCall();
|
|
34
33
|
return result;
|
|
@@ -74,7 +73,7 @@ export async function load(options = {}) {
|
|
|
74
73
|
options.onPhase?.("compiling-wasm");
|
|
75
74
|
session = await ort.InferenceSession.create(bytes, { executionProviders: ["wasm"], ...sessionOptions });
|
|
76
75
|
}
|
|
77
|
-
return instrument(new ClearModel({ ort, session, variant, backend, yieldFn: yieldToBrowser }));
|
|
76
|
+
return instrument(new ClearModel({ ort, session, variant, backend, yieldFn: yieldToBrowser }), options.usageKey);
|
|
78
77
|
}
|
|
79
78
|
function yieldToBrowser() {
|
|
80
79
|
const raf = globalThis.requestAnimationFrame;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@desert-ant-labs/clear",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "On-device speech enhancement (denoise + dereverb + podcast mastering) for Node and the browser.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.node.js",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@desert-ant-labs/desert-ant-web": "^0.
|
|
91
|
+
"@desert-ant-labs/desert-ant-web": "^0.2.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@arethetypeswrong/cli": "^0.18",
|