mezon-noise-suppression-hopsize 0.1.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/dist/AssetLoader.d.ts +10 -0
- package/dist/AssetLoader.js +38 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/interfaces.d.ts +8 -0
- package/dist/interfaces.js +2 -0
- package/models/DeepFilterNet3_onnx.tar.gz +0 -0
- package/package.json +25 -0
- package/pkg/df_bg.wasm +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AssetConfig, AssetUrls } from './interfaces';
|
|
2
|
+
export type { AssetConfig, AssetUrls };
|
|
3
|
+
export declare class AssetLoader {
|
|
4
|
+
private readonly cdnUrl;
|
|
5
|
+
constructor(config?: AssetConfig);
|
|
6
|
+
private getCdnUrl;
|
|
7
|
+
getAssetUrls(): AssetUrls;
|
|
8
|
+
fetchAsset(url: string): Promise<ArrayBuffer>;
|
|
9
|
+
}
|
|
10
|
+
export declare function getAssetLoader(config?: AssetConfig): AssetLoader;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssetLoader = void 0;
|
|
4
|
+
exports.getAssetLoader = getAssetLoader;
|
|
5
|
+
class AssetLoader {
|
|
6
|
+
constructor(config = {}) {
|
|
7
|
+
// Default to a placeholder or the original. Keeping original as reference or changing to a generic one if published.
|
|
8
|
+
// If this package is published to npm, files will be available at unpkg or jsdelivr.
|
|
9
|
+
this.cdnUrl = config.cdnUrl ?? 'https://cdn.mezon.ai/AI/models/datas/noise_suppression/deepfilternet3';
|
|
10
|
+
}
|
|
11
|
+
getCdnUrl(relativePath) {
|
|
12
|
+
// Remove leading slash if present to avoid double slashes with base URL
|
|
13
|
+
const cleanPath = relativePath.startsWith('/') ? relativePath.slice(1) : relativePath;
|
|
14
|
+
const cleanCdnUrl = this.cdnUrl.endsWith('/') ? this.cdnUrl.slice(0, -1) : this.cdnUrl;
|
|
15
|
+
return `${cleanCdnUrl}/${cleanPath}`;
|
|
16
|
+
}
|
|
17
|
+
getAssetUrls() {
|
|
18
|
+
return {
|
|
19
|
+
wasm: this.getCdnUrl('pkg/df_bg.wasm'),
|
|
20
|
+
model: this.getCdnUrl('models/DeepFilterNet3_onnx.tar.gz')
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async fetchAsset(url) {
|
|
24
|
+
const response = await fetch(url);
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
throw new Error(`Failed to fetch asset: ${response.statusText}`);
|
|
27
|
+
}
|
|
28
|
+
return response.arrayBuffer();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.AssetLoader = AssetLoader;
|
|
32
|
+
let defaultLoader = null;
|
|
33
|
+
function getAssetLoader(config) {
|
|
34
|
+
if (!defaultLoader || config) {
|
|
35
|
+
defaultLoader = new AssetLoader(config);
|
|
36
|
+
}
|
|
37
|
+
return defaultLoader;
|
|
38
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./interfaces"), exports);
|
|
18
|
+
__exportStar(require("./AssetLoader"), exports);
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mezon-noise-suppression-hopsize",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Asset loader and assets for DeepFilterNet",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"pkg/df_bg.wasm",
|
|
10
|
+
"models/DeepFilterNet3_onnx.tar.gz"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"deepfilternet",
|
|
17
|
+
"wasm",
|
|
18
|
+
"noise-suppression"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.0.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
package/pkg/df_bg.wasm
ADDED
|
Binary file
|