avatarlayer 0.1.0 → 0.2.0
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/chunk-BWOR6APZ.js +20 -0
- package/dist/chunk-BWOR6APZ.js.map +1 -0
- package/dist/index.cjs +5884 -1359
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1774 -11
- package/dist/index.d.ts +1774 -11
- package/dist/index.js +5746 -1281
- package/dist/index.js.map +1 -1
- package/dist/local.cjs +1143 -0
- package/dist/local.cjs.map +1 -0
- package/dist/local.d.cts +629 -0
- package/dist/local.d.ts +629 -0
- package/dist/local.js +1072 -0
- package/dist/local.js.map +1 -0
- package/dist/react/index.cjs +1309 -25
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +1307 -24
- package/dist/react/index.js.map +1 -1
- package/dist/server.cjs +2036 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +974 -0
- package/dist/server.d.ts +974 -0
- package/dist/server.js +1978 -0
- package/dist/server.js.map +1 -0
- package/dist/transport/index.cjs +203 -0
- package/dist/transport/index.cjs.map +1 -0
- package/dist/transport/index.js +173 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/viseme-profile-M5VOUVCH.js +24 -0
- package/dist/viseme-profile-M5VOUVCH.js.map +1 -0
- package/dist/webgpu-ZPTKA5NK.js +9 -0
- package/dist/webgpu-ZPTKA5NK.js.map +1 -0
- package/package.json +89 -10
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/webgpu.ts
|
|
2
|
+
async function isWebGPUSupported() {
|
|
3
|
+
const nav = typeof navigator !== "undefined" ? navigator : void 0;
|
|
4
|
+
if (!nav?.gpu) return false;
|
|
5
|
+
try {
|
|
6
|
+
const adapter = await nav.gpu.requestAdapter();
|
|
7
|
+
return adapter !== null;
|
|
8
|
+
} catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async function detectBestDevice() {
|
|
13
|
+
return await isWebGPUSupported() ? "webgpu" : "wasm";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
isWebGPUSupported,
|
|
18
|
+
detectBestDevice
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-BWOR6APZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webgpu.ts"],"sourcesContent":["/**\n * WebGPU detection utilities for choosing between GPU-accelerated and\n * WASM-based inference at runtime.\n */\n\n/** Execution backend for local ML models. */\nexport type InferenceDevice = \"webgpu\" | \"wasm\" | \"cpu\";\n\n/**\n * Check whether the current environment supports WebGPU by attempting to\n * request an adapter. Returns `false` in Node.js or browsers without WebGPU.\n */\nexport async function isWebGPUSupported(): Promise<boolean> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const nav = typeof navigator !== \"undefined\" ? (navigator as any) : undefined;\n if (!nav?.gpu) return false;\n try {\n const adapter = await nav.gpu.requestAdapter();\n return adapter !== null;\n } catch {\n return false;\n }\n}\n\n/**\n * Pick the best available inference device: WebGPU when supported, otherwise\n * WASM (which is universally available in modern browsers).\n */\nexport async function detectBestDevice(): Promise<InferenceDevice> {\n return (await isWebGPUSupported()) ? \"webgpu\" : \"wasm\";\n}\n"],"mappings":";AAYA,eAAsB,oBAAsC;AAE1D,QAAM,MAAM,OAAO,cAAc,cAAe,YAAoB;AACpE,MAAI,CAAC,KAAK,IAAK,QAAO;AACtB,MAAI;AACF,UAAM,UAAU,MAAM,IAAI,IAAI,eAAe;AAC7C,WAAO,YAAY;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMA,eAAsB,mBAA6C;AACjE,SAAQ,MAAM,kBAAkB,IAAK,WAAW;AAClD;","names":[]}
|