webml-kit 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 CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="logo.png" alt="webml-kit" width="200" />
3
+ </p>
4
+
1
5
  # webml-kit
2
6
 
3
7
  > Framework-agnostic utilities for loading and running ML models in the browser via WebGPU/WASM.
@@ -9,7 +13,7 @@ This library does that part for you. It wraps [`@huggingface/transformers`](http
9
13
  ## Install
10
14
 
11
15
  ```bash
12
- npm install webml-kit @huggingface/transformers
16
+ npm install webml-kit
13
17
  ```
14
18
 
15
19
  ## Quick start
@@ -58,6 +62,26 @@ const { ok, reason } = await canRun('4GB'); // human-readable
58
62
  const same = await canRun(4_000_000_000); // raw bytes — same result
59
63
  ```
60
64
 
65
+ ### Model discovery
66
+
67
+ Search the Hugging Face Hub for models that work with webml-kit. Only returns models tagged with `transformers.js`, so everything listed runs out of the box:
68
+
69
+ ```ts
70
+ import { searchModels, listModelsForTask, trendingModels, listWebGPUModels } from 'webml-kit';
71
+
72
+ // Search by keyword
73
+ const results = await searchModels({ query: 'whisper', task: 'automatic-speech-recognition' });
74
+
75
+ // Top models for a task
76
+ const textModels = await listModelsForTask('text-generation', 5);
77
+
78
+ // What's trending right now
79
+ const hot = await trendingModels(5);
80
+
81
+ // Only from known WebGPU-friendly orgs (onnx-community, Xenova)
82
+ const webgpu = await listWebGPUModels({ task: 'text-generation' });
83
+ ```
84
+
61
85
  ### Cache visibility
62
86
 
63
87
  The worst UX in browser ML is showing "downloading 2GB..." to someone who already has the model. Now you can check:
@@ -157,6 +181,11 @@ These work without a ModelClient — useful for pre-flight checks:
157
181
  | `getCacheSize()` | Total bytes used by cached models |
158
182
  | `parseSize(input)` | Convert '4GB' / '512MB' to bytes |
159
183
  | `formatSize(bytes)` | Convert bytes to '4.0 GB' / '512.0 MB' |
184
+ | `searchModels(options?)` | Search HF Hub for transformers.js-compatible models |
185
+ | `listModelsForTask(task)` | Top models for a specific pipeline task |
186
+ | `trendingModels(limit?)` | What's trending on HF Hub right now |
187
+ | `listWebGPUModels(options?)` | Models from known WebGPU-friendly orgs |
188
+ | `getModelInfo(modelId)` | Detailed info about a specific model |
160
189
 
161
190
  ## Supported tasks
162
191
 
package/dist/hub.d.ts ADDED
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Search and list WebGPU/ONNX-compatible models from the Hugging Face Hub.
3
+ *
4
+ * Uses the public HF Hub API — no auth token needed for public models.
5
+ */
6
+ import type { PipelineTask } from './types.js';
7
+ export interface HubModel {
8
+ /** Model ID (e.g. 'onnx-community/Bonsai-1.7B-ONNX') */
9
+ modelId: string;
10
+ /** Pipeline task (e.g. 'text-generation') */
11
+ task: PipelineTask | string;
12
+ /** Author or organization */
13
+ author: string;
14
+ /** Number of downloads in the last month */
15
+ downloads: number;
16
+ /** Number of likes */
17
+ likes: number;
18
+ /** Last modified date */
19
+ lastModified: string;
20
+ /** Tags on the model (e.g. ['onnx', 'webgpu']) */
21
+ tags: string[];
22
+ /** Whether it's likely WebGPU-compatible (has ONNX weights) */
23
+ webgpuCompatible: boolean;
24
+ }
25
+ export interface SearchOptions {
26
+ /** Filter by pipeline task */
27
+ task?: PipelineTask | string;
28
+ /** Free-text search query */
29
+ query?: string;
30
+ /** Sort by: 'downloads' | 'likes' | 'modified' | 'trending' */
31
+ sort?: 'downloads' | 'likes' | 'modified' | 'trending';
32
+ /** Sort direction */
33
+ direction?: 'asc' | 'desc';
34
+ /** Max results to return (default: 20, max: 100) */
35
+ limit?: number;
36
+ /** Filter by author/org (e.g. 'onnx-community', 'Xenova') */
37
+ author?: string;
38
+ }
39
+ /** Known orgs that publish ONNX/WebGPU-ready models */
40
+ export declare const WEBGPU_ORGS: readonly ["onnx-community", "Xenova", "webml-community"];
41
+ /**
42
+ * Search for models compatible with transformers.js (and thus WebGPU/WASM).
43
+ *
44
+ * ```ts
45
+ * import { searchModels } from 'webml-kit';
46
+ *
47
+ * const models = await searchModels({ task: 'text-generation', limit: 5 });
48
+ * for (const m of models) {
49
+ * console.log(`${m.modelId} — ${m.downloads} downloads`);
50
+ * }
51
+ * ```
52
+ */
53
+ export declare function searchModels(options?: SearchOptions): Promise<HubModel[]>;
54
+ /**
55
+ * List popular models for a specific task, sorted by downloads.
56
+ *
57
+ * ```ts
58
+ * import { listModelsForTask } from 'webml-kit';
59
+ *
60
+ * const models = await listModelsForTask('automatic-speech-recognition');
61
+ * // [{ modelId: 'onnx-community/whisper-tiny.en', downloads: 12345, ... }]
62
+ * ```
63
+ */
64
+ export declare function listModelsForTask(task: PipelineTask | string, limit?: number): Promise<HubModel[]>;
65
+ /**
66
+ * List trending transformers.js models right now.
67
+ *
68
+ * ```ts
69
+ * import { trendingModels } from 'webml-kit';
70
+ *
71
+ * const hot = await trendingModels(5);
72
+ * ```
73
+ */
74
+ export declare function trendingModels(limit?: number): Promise<HubModel[]>;
75
+ /**
76
+ * List all models from known WebGPU-friendly orgs
77
+ * (onnx-community, Xenova, webml-community).
78
+ *
79
+ * ```ts
80
+ * import { listWebGPUModels } from 'webml-kit';
81
+ *
82
+ * const models = await listWebGPUModels({ task: 'text-generation' });
83
+ * ```
84
+ */
85
+ export declare function listWebGPUModels(options?: Omit<SearchOptions, 'author'>): Promise<HubModel[]>;
86
+ /**
87
+ * Get detailed info about a specific model.
88
+ *
89
+ * ```ts
90
+ * import { getModelInfo } from 'webml-kit';
91
+ *
92
+ * const info = await getModelInfo('onnx-community/Bonsai-1.7B-ONNX');
93
+ * console.log(info.task, info.downloads, info.webgpuCompatible);
94
+ * ```
95
+ */
96
+ export declare function getModelInfo(modelId: string): Promise<HubModel>;
97
+ //# sourceMappingURL=hub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub.d.ts","sourceRoot":"","sources":["../src/hub.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;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G;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAM,GAC1C,OAAO,CAAC,QAAQ,EAAE,CAAC,CAiBrB;AAED;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAQrE"}
package/dist/hub.js ADDED
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Search and list WebGPU/ONNX-compatible models from the Hugging Face Hub.
3
+ *
4
+ * Uses the public HF Hub API — no auth token needed for public models.
5
+ */
6
+ // ─── Constants ───
7
+ const HF_API = 'https://huggingface.co/api';
8
+ /** Known orgs that publish ONNX/WebGPU-ready models */
9
+ export const WEBGPU_ORGS = [
10
+ 'onnx-community',
11
+ 'Xenova',
12
+ 'webml-community',
13
+ ];
14
+ // ─── Core functions ───
15
+ /**
16
+ * Search for models compatible with transformers.js (and thus WebGPU/WASM).
17
+ *
18
+ * ```ts
19
+ * import { searchModels } from 'webml-kit';
20
+ *
21
+ * const models = await searchModels({ task: 'text-generation', limit: 5 });
22
+ * for (const m of models) {
23
+ * console.log(`${m.modelId} — ${m.downloads} downloads`);
24
+ * }
25
+ * ```
26
+ */
27
+ export async function searchModels(options = {}) {
28
+ const params = new URLSearchParams();
29
+ // Only show models that work with transformers.js
30
+ params.set('library', 'transformers.js');
31
+ if (options.task)
32
+ params.set('pipeline_tag', options.task);
33
+ if (options.query)
34
+ params.set('search', options.query);
35
+ if (options.author)
36
+ params.set('author', options.author);
37
+ if (options.sort === 'trending') {
38
+ params.set('sort', 'trending');
39
+ }
40
+ else if (options.sort) {
41
+ params.set('sort', options.sort === 'modified' ? 'lastModified' : options.sort);
42
+ params.set('direction', options.direction === 'asc' ? '1' : '-1');
43
+ }
44
+ else {
45
+ params.set('sort', 'downloads');
46
+ params.set('direction', '-1');
47
+ }
48
+ params.set('limit', String(Math.min(options.limit ?? 20, 100)));
49
+ const url = `${HF_API}/models?${params.toString()}`;
50
+ const response = await fetch(url);
51
+ if (!response.ok) {
52
+ throw new Error(`HF Hub API error: ${response.status} ${response.statusText}`);
53
+ }
54
+ const data = await response.json();
55
+ return data.map(normalizeModel);
56
+ }
57
+ /**
58
+ * List popular models for a specific task, sorted by downloads.
59
+ *
60
+ * ```ts
61
+ * import { listModelsForTask } from 'webml-kit';
62
+ *
63
+ * const models = await listModelsForTask('automatic-speech-recognition');
64
+ * // [{ modelId: 'onnx-community/whisper-tiny.en', downloads: 12345, ... }]
65
+ * ```
66
+ */
67
+ export async function listModelsForTask(task, limit = 10) {
68
+ return searchModels({ task, sort: 'downloads', limit });
69
+ }
70
+ /**
71
+ * List trending transformers.js models right now.
72
+ *
73
+ * ```ts
74
+ * import { trendingModels } from 'webml-kit';
75
+ *
76
+ * const hot = await trendingModels(5);
77
+ * ```
78
+ */
79
+ export async function trendingModels(limit = 10) {
80
+ return searchModels({ sort: 'trending', limit });
81
+ }
82
+ /**
83
+ * List all models from known WebGPU-friendly orgs
84
+ * (onnx-community, Xenova, webml-community).
85
+ *
86
+ * ```ts
87
+ * import { listWebGPUModels } from 'webml-kit';
88
+ *
89
+ * const models = await listWebGPUModels({ task: 'text-generation' });
90
+ * ```
91
+ */
92
+ export async function listWebGPUModels(options = {}) {
93
+ const results = [];
94
+ for (const org of WEBGPU_ORGS) {
95
+ const models = await searchModels({ ...options, author: org });
96
+ results.push(...models);
97
+ }
98
+ // Deduplicate by modelId and sort by downloads
99
+ const seen = new Set();
100
+ return results
101
+ .filter((m) => {
102
+ if (seen.has(m.modelId))
103
+ return false;
104
+ seen.add(m.modelId);
105
+ return true;
106
+ })
107
+ .sort((a, b) => b.downloads - a.downloads);
108
+ }
109
+ /**
110
+ * Get detailed info about a specific model.
111
+ *
112
+ * ```ts
113
+ * import { getModelInfo } from 'webml-kit';
114
+ *
115
+ * const info = await getModelInfo('onnx-community/Bonsai-1.7B-ONNX');
116
+ * console.log(info.task, info.downloads, info.webgpuCompatible);
117
+ * ```
118
+ */
119
+ export async function getModelInfo(modelId) {
120
+ const response = await fetch(`${HF_API}/models/${modelId}`);
121
+ if (!response.ok) {
122
+ throw new Error(`Model not found: ${modelId} (${response.status})`);
123
+ }
124
+ const data = await response.json();
125
+ return normalizeModel(data);
126
+ }
127
+ function normalizeModel(raw) {
128
+ const id = raw.modelId ?? raw.id ?? 'unknown';
129
+ const tags = raw.tags ?? [];
130
+ const author = raw.author ?? id.split('/')[0] ?? 'unknown';
131
+ return {
132
+ modelId: id,
133
+ task: (raw.pipeline_tag ?? 'unknown'),
134
+ author,
135
+ downloads: raw.downloads ?? 0,
136
+ likes: raw.likes ?? 0,
137
+ lastModified: raw.lastModified ?? '',
138
+ tags,
139
+ webgpuCompatible: tags.includes('onnx') || WEBGPU_ORGS.some((org) => id.startsWith(org)),
140
+ };
141
+ }
142
+ //# sourceMappingURL=hub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hub.js","sourceRoot":"","sources":["../src/hub.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwCH,oBAAoB;AAEpB,MAAM,MAAM,GAAG,4BAA4B,CAAC;AAE5C,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,gBAAgB;IAChB,QAAQ;IACR,iBAAiB;CACT,CAAC;AAEX,yBAAyB;AAEzB;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,UAAyB,EAAE;IAC5D,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IAErC,kDAAkD;IAClD,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAEzC,IAAI,OAAO,CAAC,IAAI;QAAE,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACvD,IAAI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C,OAAe;IAChD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,WAAW,OAAO,EAAE,CAAC,CAAC;IAC5D,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,IAAI,GAAgB,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAChD,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAeD,SAAS,cAAc,CAAC,GAAgB;IACtC,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,EAAE,IAAI,SAAS,CAAC;IAC9C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;IAE3D,OAAO;QACL,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,SAAS,CAA0B;QAC9D,MAAM;QACN,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,CAAC;QAC7B,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;QACrB,YAAY,EAAE,GAAG,CAAC,YAAY,IAAI,EAAE;QACpC,IAAI;QACJ,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KACzF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -47,5 +47,7 @@ export { GPURecovery } from './gpu-recovery.js';
47
47
  export type { RecoveryState, GPURecoveryEvents } from './gpu-recovery.js';
48
48
  export { PIPELINE_REGISTRY, getPipelineDefaults, supportsStreaming, } from './pipelines/index.js';
49
49
  export type { PipelineDefaults } from './pipelines/index.js';
50
+ export { searchModels, listModelsForTask, trendingModels, listWebGPUModels, getModelInfo, WEBGPU_ORGS, } from './hub.js';
51
+ export type { HubModel, SearchOptions } from './hub.js';
50
52
  export type { DeviceBackend, DeviceInfo, GPUInfo, QuantizationType, PipelineTask, ModelConfig, ProgressEvent, ProgressCallback, TokenEvent, ChatMessage, TextGenerationOptions, TextGenerationResult, ClassificationResult, DetectionResult, TranscriptionResult, EmbeddingResult, CaptionResult, TextResult, CacheBackend, CachedModel, } from './types.js';
51
53
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGtE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D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AAGxD,YAAY,EACV,aAAa,EACb,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -50,4 +50,6 @@ export { TokenStream, collectStream } from './streaming.js';
50
50
  export { GPURecovery } from './gpu-recovery.js';
51
51
  // ─── Pipelines ───
52
52
  export { PIPELINE_REGISTRY, getPipelineDefaults, supportsStreaming, } from './pipelines/index.js';
53
+ // ─── Hub Search ───
54
+ export { searchModels, listModelsForTask, trendingModels, listWebGPUModels, getModelInfo, WEBGPU_ORGS, } from './hub.js';
53
55
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,2BAA2B;AAC3B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,gBAAgB;AAChB,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,oBAAoB;AACpB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE5D,uBAAuB;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,oBAAoB;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,2BAA2B;AAC3B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,gBAAgB;AAChB,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,oBAAoB;AACpB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE5D,uBAAuB;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,oBAAoB;AACpB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAG9B,qBAAqB;AACrB,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,WAAW,GACZ,MAAM,UAAU,CAAC"}
package/logo.png ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webml-kit",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Framework-agnostic utilities for loading and running ML models in the browser via WebGPU/WASM",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,8 @@
17
17
  },
18
18
  "files": [
19
19
  "dist",
20
- "README.md"
20
+ "README.md",
21
+ "logo.png"
21
22
  ],
22
23
  "scripts": {
23
24
  "build": "tsc",
@@ -44,11 +45,10 @@
44
45
  "type": "git",
45
46
  "url": "https://github.com/hemanth/webml-kit.git"
46
47
  },
47
- "peerDependencies": {
48
- "@huggingface/transformers": ">=4.0.0"
48
+ "dependencies": {
49
+ "@huggingface/transformers": "^4.1.0"
49
50
  },
50
51
  "devDependencies": {
51
- "@huggingface/transformers": "^4.1.0",
52
52
  "@webgpu/types": "^0.1.69",
53
53
  "typescript": "^5.7.0",
54
54
  "vitest": "^4.1.4"