web-sdk-pp-detection 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/README.md +30 -20
- package/dist/browser-global.js +335 -93
- package/dist/browser-global.js.map +1 -1
- package/dist/index.d.ts +29 -3
- package/dist/index.js +335 -93
- package/dist/index.js.map +1 -1
- package/dist/inference.worker.js +14 -5
- package/dist/inference.worker.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -228,6 +228,12 @@ interface PPDetectionFallback {
|
|
|
228
228
|
readonly variantId: string;
|
|
229
229
|
}
|
|
230
230
|
interface PPDetectionRuntimeInfo {
|
|
231
|
+
readonly runtimeVersion?: string | null;
|
|
232
|
+
readonly environment?: Readonly<{
|
|
233
|
+
userAgent: string | null;
|
|
234
|
+
platform: string | null;
|
|
235
|
+
capturedAt: string;
|
|
236
|
+
}>;
|
|
231
237
|
readonly requestedBackend: BackendPreference;
|
|
232
238
|
readonly backend: Backend;
|
|
233
239
|
readonly precision: Precision;
|
|
@@ -252,6 +258,7 @@ interface PPDetectionModelSourceInfo {
|
|
|
252
258
|
readonly sha256: string;
|
|
253
259
|
}
|
|
254
260
|
interface PPDetectionLoadTimings {
|
|
261
|
+
readonly modelSource?: "network" | "cache" | "memory";
|
|
255
262
|
readonly modelDownloadMs?: number;
|
|
256
263
|
readonly modelCacheReadMs?: number;
|
|
257
264
|
readonly integrityMs?: number;
|
|
@@ -418,6 +425,9 @@ interface OrtInferenceSession {
|
|
|
418
425
|
interface OrtModule {
|
|
419
426
|
readonly env: {
|
|
420
427
|
readonly wasm?: Record<string, unknown>;
|
|
428
|
+
readonly versions?: {
|
|
429
|
+
readonly web?: string;
|
|
430
|
+
};
|
|
421
431
|
};
|
|
422
432
|
readonly InferenceSession: {
|
|
423
433
|
create(model: ArrayBuffer, options: Record<string, unknown>): Promise<OrtInferenceSession>;
|
|
@@ -425,6 +435,7 @@ interface OrtModule {
|
|
|
425
435
|
readonly Tensor?: new (type: string, data: unknown, dims: readonly number[]) => unknown;
|
|
426
436
|
}
|
|
427
437
|
interface OrtSessionHandle {
|
|
438
|
+
readonly runtimeVersion?: string | null;
|
|
428
439
|
readonly plan: ExecutionPlan;
|
|
429
440
|
readonly sessionMs: number;
|
|
430
441
|
run(feeds: Record<string, unknown>, options?: {
|
|
@@ -522,11 +533,16 @@ interface CacheEstimate {
|
|
|
522
533
|
readonly entries: number;
|
|
523
534
|
}
|
|
524
535
|
interface ModelCache {
|
|
536
|
+
readonly scope?: object;
|
|
525
537
|
get(key: string): Promise<ArrayBuffer | undefined>;
|
|
526
538
|
put(key: string, bytes: ArrayBuffer): Promise<void>;
|
|
527
539
|
clearCurrent(key: string): Promise<void>;
|
|
528
540
|
clearAll(): Promise<void>;
|
|
529
541
|
estimate(): Promise<CacheEstimate>;
|
|
542
|
+
list?(): Promise<readonly {
|
|
543
|
+
key: string;
|
|
544
|
+
bytes: number;
|
|
545
|
+
}[]>;
|
|
530
546
|
close?(): Promise<void> | void;
|
|
531
547
|
}
|
|
532
548
|
|
|
@@ -559,6 +575,7 @@ interface LoadedManagedModel {
|
|
|
559
575
|
declare class ModelManager {
|
|
560
576
|
private readonly fetcher?;
|
|
561
577
|
private readonly cache;
|
|
578
|
+
private readonly coordinator;
|
|
562
579
|
private readonly lifecycle;
|
|
563
580
|
private readonly activeLoads;
|
|
564
581
|
private currentKey?;
|
|
@@ -569,8 +586,8 @@ declare class ModelManager {
|
|
|
569
586
|
load(options: LoadManagedModelOptions): Promise<LoadedManagedModel>;
|
|
570
587
|
private loadActive;
|
|
571
588
|
estimate(): Promise<CacheEstimate>;
|
|
572
|
-
getCacheEstimate(): Promise<CacheEstimate>;
|
|
573
|
-
clearCurrentModelCache(): Promise<void>;
|
|
589
|
+
getCacheEstimate(model?: ModelIdentity): Promise<CacheEstimate>;
|
|
590
|
+
clearCurrentModelCache(model?: ModelIdentity): Promise<void>;
|
|
574
591
|
clearAllCache(): Promise<void>;
|
|
575
592
|
dispose(): Promise<void>;
|
|
576
593
|
}
|
|
@@ -583,6 +600,10 @@ declare class MemoryModelCache implements ModelCache {
|
|
|
583
600
|
clearAll(): Promise<void>;
|
|
584
601
|
estimate(): Promise<CacheEstimate>;
|
|
585
602
|
close(): Promise<void>;
|
|
603
|
+
list(): Promise<readonly {
|
|
604
|
+
key: string;
|
|
605
|
+
bytes: number;
|
|
606
|
+
}[]>;
|
|
586
607
|
}
|
|
587
608
|
|
|
588
609
|
interface IndexedDBModelCacheOptions {
|
|
@@ -590,6 +611,7 @@ interface IndexedDBModelCacheOptions {
|
|
|
590
611
|
readonly databaseName?: string;
|
|
591
612
|
}
|
|
592
613
|
declare class IndexedDBModelCache implements ModelCache {
|
|
614
|
+
readonly scope: object;
|
|
593
615
|
private readonly factory;
|
|
594
616
|
private readonly databaseName;
|
|
595
617
|
private database?;
|
|
@@ -600,6 +622,10 @@ declare class IndexedDBModelCache implements ModelCache {
|
|
|
600
622
|
clearAll(): Promise<void>;
|
|
601
623
|
estimate(): Promise<CacheEstimate>;
|
|
602
624
|
close(): Promise<void>;
|
|
625
|
+
list(): Promise<readonly {
|
|
626
|
+
key: string;
|
|
627
|
+
bytes: number;
|
|
628
|
+
}[]>;
|
|
603
629
|
private open;
|
|
604
630
|
private request;
|
|
605
631
|
}
|
|
@@ -607,7 +633,7 @@ declare class IndexedDBModelCache implements ModelCache {
|
|
|
607
633
|
declare global {
|
|
608
634
|
var __PPDETECTION_SCRIPT_URL__: string | undefined;
|
|
609
635
|
}
|
|
610
|
-
declare const CURRENT_SDK_VERSION = "0.
|
|
636
|
+
declare const CURRENT_SDK_VERSION = "0.2.0";
|
|
611
637
|
|
|
612
638
|
declare function probePPDetectionCapabilities(options?: CapabilityProbeOptions): DetectionCapabilities;
|
|
613
639
|
|