No public description
PiperOrigin-RevId: 564894013
This commit is contained in:
parent
df211d211e
commit
a5a3e9d36b
|
@ -47,10 +47,15 @@ async function isSimdSupported(): Promise<boolean> {
|
|||
}
|
||||
|
||||
async function createFileset(
|
||||
taskName: MediapipeTaskCategory, basePath = ''): Promise<WasmFileset> {
|
||||
taskName: MediapipeTaskCategory, basePath?: string): Promise<WasmFileset> {
|
||||
const suffix =
|
||||
await isSimdSupported() ? 'wasm_internal' : 'wasm_nosimd_internal';
|
||||
|
||||
// For backwards compatiblity, we treat an unset `basePath` as a relative
|
||||
// path. FilesetResolver provides an empty path as a default, which is not
|
||||
// rewritten to '.'.
|
||||
basePath = basePath ?? '.';
|
||||
|
||||
return {
|
||||
wasmLoaderPath: `${basePath}/${taskName}_${suffix}.js`,
|
||||
wasmBinaryPath: `${basePath}/${taskName}_${suffix}.wasm`,
|
||||
|
@ -93,7 +98,7 @@ export class FilesetResolver {
|
|||
* @return A `WasmFileset` that can be used to initialize MediaPipe Audio
|
||||
* tasks.
|
||||
*/
|
||||
static forAudioTasks(basePath?: string): Promise<WasmFileset> {
|
||||
static forAudioTasks(basePath = ''): Promise<WasmFileset> {
|
||||
return createFileset('audio', basePath);
|
||||
}
|
||||
|
||||
|
@ -107,7 +112,7 @@ export class FilesetResolver {
|
|||
* @return A `WasmFileset` that can be used to initialize MediaPipe Text
|
||||
* tasks.
|
||||
*/
|
||||
static forTextTasks(basePath?: string): Promise<WasmFileset> {
|
||||
static forTextTasks(basePath = ''): Promise<WasmFileset> {
|
||||
return createFileset('text', basePath);
|
||||
}
|
||||
|
||||
|
@ -121,7 +126,7 @@ export class FilesetResolver {
|
|||
* @return A `WasmFileset` that can be used to initialize MediaPipe Vision
|
||||
* tasks.
|
||||
*/
|
||||
static forVisionTasks(basePath?: string): Promise<WasmFileset> {
|
||||
static forVisionTasks(basePath = ''): Promise<WasmFileset> {
|
||||
return createFileset('vision', basePath);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user