abenkbp commited on
Commit
9059342
·
1 Parent(s): 14f6689
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. data/node_modules/.bin/mime +0 -1
  2. data/node_modules/.package-lock.json +0 -782
  3. data/node_modules/@huggingface/inference/LICENSE +0 -21
  4. data/node_modules/@huggingface/inference/README.md +0 -633
  5. data/node_modules/@huggingface/inference/dist/index.cjs +0 -999
  6. data/node_modules/@huggingface/inference/dist/index.js +0 -945
  7. data/node_modules/@huggingface/inference/dist/src/HfInference.d.ts +0 -28
  8. data/node_modules/@huggingface/inference/dist/src/HfInference.d.ts.map +0 -1
  9. data/node_modules/@huggingface/inference/dist/src/index.d.ts +0 -5
  10. data/node_modules/@huggingface/inference/dist/src/index.d.ts.map +0 -1
  11. data/node_modules/@huggingface/inference/dist/src/lib/InferenceOutputError.d.ts +0 -4
  12. data/node_modules/@huggingface/inference/dist/src/lib/InferenceOutputError.d.ts.map +0 -1
  13. data/node_modules/@huggingface/inference/dist/src/lib/getDefaultTask.d.ts +0 -12
  14. data/node_modules/@huggingface/inference/dist/src/lib/getDefaultTask.d.ts.map +0 -1
  15. data/node_modules/@huggingface/inference/dist/src/lib/isUrl.d.ts +0 -2
  16. data/node_modules/@huggingface/inference/dist/src/lib/isUrl.d.ts.map +0 -1
  17. data/node_modules/@huggingface/inference/dist/src/lib/makeRequestOptions.d.ts +0 -18
  18. data/node_modules/@huggingface/inference/dist/src/lib/makeRequestOptions.d.ts.map +0 -1
  19. data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioClassification.d.ts +0 -24
  20. data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioClassification.d.ts.map +0 -1
  21. data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioToAudio.d.ts +0 -28
  22. data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioToAudio.d.ts.map +0 -1
  23. data/node_modules/@huggingface/inference/dist/src/tasks/audio/automaticSpeechRecognition.d.ts +0 -19
  24. data/node_modules/@huggingface/inference/dist/src/tasks/audio/automaticSpeechRecognition.d.ts.map +0 -1
  25. data/node_modules/@huggingface/inference/dist/src/tasks/audio/textToSpeech.d.ts +0 -14
  26. data/node_modules/@huggingface/inference/dist/src/tasks/audio/textToSpeech.d.ts.map +0 -1
  27. data/node_modules/@huggingface/inference/dist/src/tasks/custom/request.d.ts +0 -13
  28. data/node_modules/@huggingface/inference/dist/src/tasks/custom/request.d.ts.map +0 -1
  29. data/node_modules/@huggingface/inference/dist/src/tasks/custom/streamingRequest.d.ts +0 -13
  30. data/node_modules/@huggingface/inference/dist/src/tasks/custom/streamingRequest.d.ts.map +0 -1
  31. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageClassification.d.ts +0 -24
  32. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageClassification.d.ts.map +0 -1
  33. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageSegmentation.d.ts +0 -28
  34. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageSegmentation.d.ts.map +0 -1
  35. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToImage.d.ts +0 -55
  36. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToImage.d.ts.map +0 -1
  37. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToText.d.ts +0 -18
  38. data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToText.d.ts.map +0 -1
  39. data/node_modules/@huggingface/inference/dist/src/tasks/cv/objectDetection.d.ts +0 -33
  40. data/node_modules/@huggingface/inference/dist/src/tasks/cv/objectDetection.d.ts.map +0 -1
  41. data/node_modules/@huggingface/inference/dist/src/tasks/cv/textToImage.d.ts +0 -36
  42. data/node_modules/@huggingface/inference/dist/src/tasks/cv/textToImage.d.ts.map +0 -1
  43. data/node_modules/@huggingface/inference/dist/src/tasks/cv/zeroShotImageClassification.d.ts +0 -26
  44. data/node_modules/@huggingface/inference/dist/src/tasks/cv/zeroShotImageClassification.d.ts.map +0 -1
  45. data/node_modules/@huggingface/inference/dist/src/tasks/index.d.ts +0 -32
  46. data/node_modules/@huggingface/inference/dist/src/tasks/index.d.ts.map +0 -1
  47. data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts +0 -35
  48. data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts.map +0 -1
  49. data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts +0 -27
  50. data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts.map +0 -1
data/node_modules/.bin/mime DELETED
@@ -1 +0,0 @@
1
- ../mime/cli.js
 
 
data/node_modules/.package-lock.json DELETED
@@ -1,782 +0,0 @@
1
- {
2
- "name": "data",
3
- "lockfileVersion": 3,
4
- "requires": true,
5
- "packages": {
6
- "node_modules/@huggingface/inference": {
7
- "version": "2.8.0",
8
- "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.8.0.tgz",
9
- "integrity": "sha512-Ti681P1qckcCAqgzmL53jBnluPuZGelmMIuXNjgAwC5+RIjF4S0SDQu6oy44ZTwekwNp2ETaZ2sXsOk+45aC4w==",
10
- "license": "MIT",
11
- "dependencies": {
12
- "@huggingface/tasks": "^0.11.2"
13
- },
14
- "engines": {
15
- "node": ">=18"
16
- }
17
- },
18
- "node_modules/@huggingface/tasks": {
19
- "version": "0.11.4",
20
- "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.11.4.tgz",
21
- "integrity": "sha512-DW12G7Ae643U8vwitfaZOtvuk0+3W0GfQFcxxwVkFi07neZdBnSalxeKQsoPW7tZNcUdIZJSxhrnVNFGSXeC5Q==",
22
- "license": "MIT"
23
- },
24
- "node_modules/accepts": {
25
- "version": "1.3.8",
26
- "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
27
- "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
28
- "license": "MIT",
29
- "dependencies": {
30
- "mime-types": "~2.1.34",
31
- "negotiator": "0.6.3"
32
- },
33
- "engines": {
34
- "node": ">= 0.6"
35
- }
36
- },
37
- "node_modules/array-flatten": {
38
- "version": "1.1.1",
39
- "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
40
- "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
41
- "license": "MIT"
42
- },
43
- "node_modules/body-parser": {
44
- "version": "1.20.2",
45
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
46
- "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
47
- "license": "MIT",
48
- "dependencies": {
49
- "bytes": "3.1.2",
50
- "content-type": "~1.0.5",
51
- "debug": "2.6.9",
52
- "depd": "2.0.0",
53
- "destroy": "1.2.0",
54
- "http-errors": "2.0.0",
55
- "iconv-lite": "0.4.24",
56
- "on-finished": "2.4.1",
57
- "qs": "6.11.0",
58
- "raw-body": "2.5.2",
59
- "type-is": "~1.6.18",
60
- "unpipe": "1.0.0"
61
- },
62
- "engines": {
63
- "node": ">= 0.8",
64
- "npm": "1.2.8000 || >= 1.4.16"
65
- }
66
- },
67
- "node_modules/bytes": {
68
- "version": "3.1.2",
69
- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
70
- "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
71
- "license": "MIT",
72
- "engines": {
73
- "node": ">= 0.8"
74
- }
75
- },
76
- "node_modules/call-bind": {
77
- "version": "1.0.7",
78
- "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
79
- "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
80
- "license": "MIT",
81
- "dependencies": {
82
- "es-define-property": "^1.0.0",
83
- "es-errors": "^1.3.0",
84
- "function-bind": "^1.1.2",
85
- "get-intrinsic": "^1.2.4",
86
- "set-function-length": "^1.2.1"
87
- },
88
- "engines": {
89
- "node": ">= 0.4"
90
- },
91
- "funding": {
92
- "url": "https://github.com/sponsors/ljharb"
93
- }
94
- },
95
- "node_modules/content-disposition": {
96
- "version": "0.5.4",
97
- "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
98
- "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
99
- "license": "MIT",
100
- "dependencies": {
101
- "safe-buffer": "5.2.1"
102
- },
103
- "engines": {
104
- "node": ">= 0.6"
105
- }
106
- },
107
- "node_modules/content-type": {
108
- "version": "1.0.5",
109
- "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
110
- "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
111
- "license": "MIT",
112
- "engines": {
113
- "node": ">= 0.6"
114
- }
115
- },
116
- "node_modules/cookie": {
117
- "version": "0.6.0",
118
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
119
- "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
120
- "license": "MIT",
121
- "engines": {
122
- "node": ">= 0.6"
123
- }
124
- },
125
- "node_modules/cookie-signature": {
126
- "version": "1.0.6",
127
- "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
128
- "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
129
- "license": "MIT"
130
- },
131
- "node_modules/debug": {
132
- "version": "2.6.9",
133
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
134
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
135
- "license": "MIT",
136
- "dependencies": {
137
- "ms": "2.0.0"
138
- }
139
- },
140
- "node_modules/define-data-property": {
141
- "version": "1.1.4",
142
- "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
143
- "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
144
- "license": "MIT",
145
- "dependencies": {
146
- "es-define-property": "^1.0.0",
147
- "es-errors": "^1.3.0",
148
- "gopd": "^1.0.1"
149
- },
150
- "engines": {
151
- "node": ">= 0.4"
152
- },
153
- "funding": {
154
- "url": "https://github.com/sponsors/ljharb"
155
- }
156
- },
157
- "node_modules/depd": {
158
- "version": "2.0.0",
159
- "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
160
- "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
161
- "license": "MIT",
162
- "engines": {
163
- "node": ">= 0.8"
164
- }
165
- },
166
- "node_modules/destroy": {
167
- "version": "1.2.0",
168
- "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
169
- "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
170
- "license": "MIT",
171
- "engines": {
172
- "node": ">= 0.8",
173
- "npm": "1.2.8000 || >= 1.4.16"
174
- }
175
- },
176
- "node_modules/dotenv": {
177
- "version": "16.4.5",
178
- "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
179
- "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
180
- "license": "BSD-2-Clause",
181
- "engines": {
182
- "node": ">=12"
183
- },
184
- "funding": {
185
- "url": "https://dotenvx.com"
186
- }
187
- },
188
- "node_modules/ee-first": {
189
- "version": "1.1.1",
190
- "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
191
- "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
192
- "license": "MIT"
193
- },
194
- "node_modules/encodeurl": {
195
- "version": "1.0.2",
196
- "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
197
- "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
198
- "license": "MIT",
199
- "engines": {
200
- "node": ">= 0.8"
201
- }
202
- },
203
- "node_modules/es-define-property": {
204
- "version": "1.0.0",
205
- "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
206
- "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
207
- "license": "MIT",
208
- "dependencies": {
209
- "get-intrinsic": "^1.2.4"
210
- },
211
- "engines": {
212
- "node": ">= 0.4"
213
- }
214
- },
215
- "node_modules/es-errors": {
216
- "version": "1.3.0",
217
- "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
218
- "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
219
- "license": "MIT",
220
- "engines": {
221
- "node": ">= 0.4"
222
- }
223
- },
224
- "node_modules/escape-html": {
225
- "version": "1.0.3",
226
- "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
227
- "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
228
- "license": "MIT"
229
- },
230
- "node_modules/etag": {
231
- "version": "1.8.1",
232
- "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
233
- "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
234
- "license": "MIT",
235
- "engines": {
236
- "node": ">= 0.6"
237
- }
238
- },
239
- "node_modules/express": {
240
- "version": "4.19.2",
241
- "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
242
- "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
243
- "license": "MIT",
244
- "dependencies": {
245
- "accepts": "~1.3.8",
246
- "array-flatten": "1.1.1",
247
- "body-parser": "1.20.2",
248
- "content-disposition": "0.5.4",
249
- "content-type": "~1.0.4",
250
- "cookie": "0.6.0",
251
- "cookie-signature": "1.0.6",
252
- "debug": "2.6.9",
253
- "depd": "2.0.0",
254
- "encodeurl": "~1.0.2",
255
- "escape-html": "~1.0.3",
256
- "etag": "~1.8.1",
257
- "finalhandler": "1.2.0",
258
- "fresh": "0.5.2",
259
- "http-errors": "2.0.0",
260
- "merge-descriptors": "1.0.1",
261
- "methods": "~1.1.2",
262
- "on-finished": "2.4.1",
263
- "parseurl": "~1.3.3",
264
- "path-to-regexp": "0.1.7",
265
- "proxy-addr": "~2.0.7",
266
- "qs": "6.11.0",
267
- "range-parser": "~1.2.1",
268
- "safe-buffer": "5.2.1",
269
- "send": "0.18.0",
270
- "serve-static": "1.15.0",
271
- "setprototypeof": "1.2.0",
272
- "statuses": "2.0.1",
273
- "type-is": "~1.6.18",
274
- "utils-merge": "1.0.1",
275
- "vary": "~1.1.2"
276
- },
277
- "engines": {
278
- "node": ">= 0.10.0"
279
- }
280
- },
281
- "node_modules/finalhandler": {
282
- "version": "1.2.0",
283
- "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
284
- "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
285
- "license": "MIT",
286
- "dependencies": {
287
- "debug": "2.6.9",
288
- "encodeurl": "~1.0.2",
289
- "escape-html": "~1.0.3",
290
- "on-finished": "2.4.1",
291
- "parseurl": "~1.3.3",
292
- "statuses": "2.0.1",
293
- "unpipe": "~1.0.0"
294
- },
295
- "engines": {
296
- "node": ">= 0.8"
297
- }
298
- },
299
- "node_modules/forwarded": {
300
- "version": "0.2.0",
301
- "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
302
- "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
303
- "license": "MIT",
304
- "engines": {
305
- "node": ">= 0.6"
306
- }
307
- },
308
- "node_modules/fresh": {
309
- "version": "0.5.2",
310
- "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
311
- "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
312
- "license": "MIT",
313
- "engines": {
314
- "node": ">= 0.6"
315
- }
316
- },
317
- "node_modules/function-bind": {
318
- "version": "1.1.2",
319
- "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
320
- "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
321
- "license": "MIT",
322
- "funding": {
323
- "url": "https://github.com/sponsors/ljharb"
324
- }
325
- },
326
- "node_modules/get-intrinsic": {
327
- "version": "1.2.4",
328
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
329
- "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
330
- "license": "MIT",
331
- "dependencies": {
332
- "es-errors": "^1.3.0",
333
- "function-bind": "^1.1.2",
334
- "has-proto": "^1.0.1",
335
- "has-symbols": "^1.0.3",
336
- "hasown": "^2.0.0"
337
- },
338
- "engines": {
339
- "node": ">= 0.4"
340
- },
341
- "funding": {
342
- "url": "https://github.com/sponsors/ljharb"
343
- }
344
- },
345
- "node_modules/gopd": {
346
- "version": "1.0.1",
347
- "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
348
- "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
349
- "license": "MIT",
350
- "dependencies": {
351
- "get-intrinsic": "^1.1.3"
352
- },
353
- "funding": {
354
- "url": "https://github.com/sponsors/ljharb"
355
- }
356
- },
357
- "node_modules/has-property-descriptors": {
358
- "version": "1.0.2",
359
- "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
360
- "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
361
- "license": "MIT",
362
- "dependencies": {
363
- "es-define-property": "^1.0.0"
364
- },
365
- "funding": {
366
- "url": "https://github.com/sponsors/ljharb"
367
- }
368
- },
369
- "node_modules/has-proto": {
370
- "version": "1.0.3",
371
- "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
372
- "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
373
- "license": "MIT",
374
- "engines": {
375
- "node": ">= 0.4"
376
- },
377
- "funding": {
378
- "url": "https://github.com/sponsors/ljharb"
379
- }
380
- },
381
- "node_modules/has-symbols": {
382
- "version": "1.0.3",
383
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
384
- "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
385
- "license": "MIT",
386
- "engines": {
387
- "node": ">= 0.4"
388
- },
389
- "funding": {
390
- "url": "https://github.com/sponsors/ljharb"
391
- }
392
- },
393
- "node_modules/hasown": {
394
- "version": "2.0.2",
395
- "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
396
- "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
397
- "license": "MIT",
398
- "dependencies": {
399
- "function-bind": "^1.1.2"
400
- },
401
- "engines": {
402
- "node": ">= 0.4"
403
- }
404
- },
405
- "node_modules/http-errors": {
406
- "version": "2.0.0",
407
- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
408
- "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
409
- "license": "MIT",
410
- "dependencies": {
411
- "depd": "2.0.0",
412
- "inherits": "2.0.4",
413
- "setprototypeof": "1.2.0",
414
- "statuses": "2.0.1",
415
- "toidentifier": "1.0.1"
416
- },
417
- "engines": {
418
- "node": ">= 0.8"
419
- }
420
- },
421
- "node_modules/iconv-lite": {
422
- "version": "0.4.24",
423
- "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
424
- "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
425
- "license": "MIT",
426
- "dependencies": {
427
- "safer-buffer": ">= 2.1.2 < 3"
428
- },
429
- "engines": {
430
- "node": ">=0.10.0"
431
- }
432
- },
433
- "node_modules/inherits": {
434
- "version": "2.0.4",
435
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
436
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
437
- "license": "ISC"
438
- },
439
- "node_modules/ipaddr.js": {
440
- "version": "1.9.1",
441
- "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
442
- "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
443
- "license": "MIT",
444
- "engines": {
445
- "node": ">= 0.10"
446
- }
447
- },
448
- "node_modules/media-typer": {
449
- "version": "0.3.0",
450
- "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
451
- "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
452
- "license": "MIT",
453
- "engines": {
454
- "node": ">= 0.6"
455
- }
456
- },
457
- "node_modules/merge-descriptors": {
458
- "version": "1.0.1",
459
- "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
460
- "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==",
461
- "license": "MIT"
462
- },
463
- "node_modules/methods": {
464
- "version": "1.1.2",
465
- "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
466
- "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
467
- "license": "MIT",
468
- "engines": {
469
- "node": ">= 0.6"
470
- }
471
- },
472
- "node_modules/mime": {
473
- "version": "1.6.0",
474
- "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
475
- "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
476
- "license": "MIT",
477
- "bin": {
478
- "mime": "cli.js"
479
- },
480
- "engines": {
481
- "node": ">=4"
482
- }
483
- },
484
- "node_modules/mime-db": {
485
- "version": "1.52.0",
486
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
487
- "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
488
- "license": "MIT",
489
- "engines": {
490
- "node": ">= 0.6"
491
- }
492
- },
493
- "node_modules/mime-types": {
494
- "version": "2.1.35",
495
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
496
- "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
497
- "license": "MIT",
498
- "dependencies": {
499
- "mime-db": "1.52.0"
500
- },
501
- "engines": {
502
- "node": ">= 0.6"
503
- }
504
- },
505
- "node_modules/ms": {
506
- "version": "2.0.0",
507
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
508
- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
509
- "license": "MIT"
510
- },
511
- "node_modules/negotiator": {
512
- "version": "0.6.3",
513
- "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
514
- "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
515
- "license": "MIT",
516
- "engines": {
517
- "node": ">= 0.6"
518
- }
519
- },
520
- "node_modules/object-inspect": {
521
- "version": "1.13.2",
522
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
523
- "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==",
524
- "license": "MIT",
525
- "engines": {
526
- "node": ">= 0.4"
527
- },
528
- "funding": {
529
- "url": "https://github.com/sponsors/ljharb"
530
- }
531
- },
532
- "node_modules/on-finished": {
533
- "version": "2.4.1",
534
- "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
535
- "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
536
- "license": "MIT",
537
- "dependencies": {
538
- "ee-first": "1.1.1"
539
- },
540
- "engines": {
541
- "node": ">= 0.8"
542
- }
543
- },
544
- "node_modules/parseurl": {
545
- "version": "1.3.3",
546
- "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
547
- "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
548
- "license": "MIT",
549
- "engines": {
550
- "node": ">= 0.8"
551
- }
552
- },
553
- "node_modules/path-to-regexp": {
554
- "version": "0.1.7",
555
- "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
556
- "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==",
557
- "license": "MIT"
558
- },
559
- "node_modules/proxy-addr": {
560
- "version": "2.0.7",
561
- "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
562
- "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
563
- "license": "MIT",
564
- "dependencies": {
565
- "forwarded": "0.2.0",
566
- "ipaddr.js": "1.9.1"
567
- },
568
- "engines": {
569
- "node": ">= 0.10"
570
- }
571
- },
572
- "node_modules/qs": {
573
- "version": "6.11.0",
574
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
575
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
576
- "license": "BSD-3-Clause",
577
- "dependencies": {
578
- "side-channel": "^1.0.4"
579
- },
580
- "engines": {
581
- "node": ">=0.6"
582
- },
583
- "funding": {
584
- "url": "https://github.com/sponsors/ljharb"
585
- }
586
- },
587
- "node_modules/range-parser": {
588
- "version": "1.2.1",
589
- "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
590
- "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
591
- "license": "MIT",
592
- "engines": {
593
- "node": ">= 0.6"
594
- }
595
- },
596
- "node_modules/raw-body": {
597
- "version": "2.5.2",
598
- "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
599
- "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
600
- "license": "MIT",
601
- "dependencies": {
602
- "bytes": "3.1.2",
603
- "http-errors": "2.0.0",
604
- "iconv-lite": "0.4.24",
605
- "unpipe": "1.0.0"
606
- },
607
- "engines": {
608
- "node": ">= 0.8"
609
- }
610
- },
611
- "node_modules/safe-buffer": {
612
- "version": "5.2.1",
613
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
614
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
615
- "funding": [
616
- {
617
- "type": "github",
618
- "url": "https://github.com/sponsors/feross"
619
- },
620
- {
621
- "type": "patreon",
622
- "url": "https://www.patreon.com/feross"
623
- },
624
- {
625
- "type": "consulting",
626
- "url": "https://feross.org/support"
627
- }
628
- ],
629
- "license": "MIT"
630
- },
631
- "node_modules/safer-buffer": {
632
- "version": "2.1.2",
633
- "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
634
- "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
635
- "license": "MIT"
636
- },
637
- "node_modules/send": {
638
- "version": "0.18.0",
639
- "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
640
- "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
641
- "license": "MIT",
642
- "dependencies": {
643
- "debug": "2.6.9",
644
- "depd": "2.0.0",
645
- "destroy": "1.2.0",
646
- "encodeurl": "~1.0.2",
647
- "escape-html": "~1.0.3",
648
- "etag": "~1.8.1",
649
- "fresh": "0.5.2",
650
- "http-errors": "2.0.0",
651
- "mime": "1.6.0",
652
- "ms": "2.1.3",
653
- "on-finished": "2.4.1",
654
- "range-parser": "~1.2.1",
655
- "statuses": "2.0.1"
656
- },
657
- "engines": {
658
- "node": ">= 0.8.0"
659
- }
660
- },
661
- "node_modules/send/node_modules/ms": {
662
- "version": "2.1.3",
663
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
664
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
665
- "license": "MIT"
666
- },
667
- "node_modules/serve-static": {
668
- "version": "1.15.0",
669
- "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
670
- "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
671
- "license": "MIT",
672
- "dependencies": {
673
- "encodeurl": "~1.0.2",
674
- "escape-html": "~1.0.3",
675
- "parseurl": "~1.3.3",
676
- "send": "0.18.0"
677
- },
678
- "engines": {
679
- "node": ">= 0.8.0"
680
- }
681
- },
682
- "node_modules/set-function-length": {
683
- "version": "1.2.2",
684
- "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
685
- "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
686
- "license": "MIT",
687
- "dependencies": {
688
- "define-data-property": "^1.1.4",
689
- "es-errors": "^1.3.0",
690
- "function-bind": "^1.1.2",
691
- "get-intrinsic": "^1.2.4",
692
- "gopd": "^1.0.1",
693
- "has-property-descriptors": "^1.0.2"
694
- },
695
- "engines": {
696
- "node": ">= 0.4"
697
- }
698
- },
699
- "node_modules/setprototypeof": {
700
- "version": "1.2.0",
701
- "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
702
- "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
703
- "license": "ISC"
704
- },
705
- "node_modules/side-channel": {
706
- "version": "1.0.6",
707
- "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
708
- "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
709
- "license": "MIT",
710
- "dependencies": {
711
- "call-bind": "^1.0.7",
712
- "es-errors": "^1.3.0",
713
- "get-intrinsic": "^1.2.4",
714
- "object-inspect": "^1.13.1"
715
- },
716
- "engines": {
717
- "node": ">= 0.4"
718
- },
719
- "funding": {
720
- "url": "https://github.com/sponsors/ljharb"
721
- }
722
- },
723
- "node_modules/statuses": {
724
- "version": "2.0.1",
725
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
726
- "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
727
- "license": "MIT",
728
- "engines": {
729
- "node": ">= 0.8"
730
- }
731
- },
732
- "node_modules/toidentifier": {
733
- "version": "1.0.1",
734
- "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
735
- "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
736
- "license": "MIT",
737
- "engines": {
738
- "node": ">=0.6"
739
- }
740
- },
741
- "node_modules/type-is": {
742
- "version": "1.6.18",
743
- "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
744
- "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
745
- "license": "MIT",
746
- "dependencies": {
747
- "media-typer": "0.3.0",
748
- "mime-types": "~2.1.24"
749
- },
750
- "engines": {
751
- "node": ">= 0.6"
752
- }
753
- },
754
- "node_modules/unpipe": {
755
- "version": "1.0.0",
756
- "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
757
- "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
758
- "license": "MIT",
759
- "engines": {
760
- "node": ">= 0.8"
761
- }
762
- },
763
- "node_modules/utils-merge": {
764
- "version": "1.0.1",
765
- "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
766
- "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
767
- "license": "MIT",
768
- "engines": {
769
- "node": ">= 0.4.0"
770
- }
771
- },
772
- "node_modules/vary": {
773
- "version": "1.1.2",
774
- "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
775
- "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
776
- "license": "MIT",
777
- "engines": {
778
- "node": ">= 0.8"
779
- }
780
- }
781
- }
782
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Tim Mikeladze
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/README.md DELETED
@@ -1,633 +0,0 @@
1
- # 🤗 Hugging Face Inference Endpoints
2
-
3
- A Typescript powered wrapper for the Hugging Face Inference Endpoints API. Learn more about Inference Endpoints at [Hugging Face](https://huggingface.co/inference-endpoints).
4
- It works with both [Inference API (serverless)](https://huggingface.co/docs/api-inference/index) and [Inference Endpoints (dedicated)](https://huggingface.co/docs/inference-endpoints/index).
5
-
6
- Check out the [full documentation](https://huggingface.co/docs/huggingface.js/inference/README).
7
-
8
- You can also try out a live [interactive notebook](https://observablehq.com/@huggingface/hello-huggingface-js-inference), see some demos on [hf.co/huggingfacejs](https://huggingface.co/huggingfacejs), or watch a [Scrimba tutorial that explains how Inference Endpoints works](https://scrimba.com/scrim/cod8248f5adfd6e129582c523).
9
-
10
- ## Getting Started
11
-
12
- ### Install
13
-
14
- #### Node
15
-
16
- ```console
17
- npm install @huggingface/inference
18
-
19
- pnpm add @huggingface/inference
20
-
21
- yarn add @huggingface/inference
22
- ```
23
-
24
- #### Deno
25
-
26
- ```ts
27
- // esm.sh
28
- import { HfInference } from "https://esm.sh/@huggingface/inference"
29
- // or npm:
30
- import { HfInference } from "npm:@huggingface/inference"
31
- ```
32
-
33
- ### Initialize
34
-
35
- ```typescript
36
- import { HfInference } from '@huggingface/inference'
37
-
38
- const hf = new HfInference('your access token')
39
- ```
40
-
41
- ❗**Important note:** Using an access token is optional to get started, however you will be rate limited eventually. Join [Hugging Face](https://huggingface.co/join) and then visit [access tokens](https://huggingface.co/settings/tokens) to generate your access token for **free**.
42
-
43
- Your access token should be kept private. If you need to protect it in front-end applications, we suggest setting up a proxy server that stores the access token.
44
-
45
- #### Tree-shaking
46
-
47
- You can import the functions you need directly from the module instead of using the `HfInference` class.
48
-
49
- ```ts
50
- import { textGeneration } from "@huggingface/inference";
51
-
52
- await textGeneration({
53
- accessToken: "hf_...",
54
- model: "model_or_endpoint",
55
- inputs: ...,
56
- parameters: ...
57
- })
58
- ```
59
-
60
- This will enable tree-shaking by your bundler.
61
-
62
- ## Natural Language Processing
63
-
64
- ### Text Generation
65
-
66
- Generates text from an input prompt.
67
-
68
- [Demo](https://huggingface.co/spaces/huggingfacejs/streaming-text-generation)
69
-
70
- ```typescript
71
- await hf.textGeneration({
72
- model: 'gpt2',
73
- inputs: 'The answer to the universe is'
74
- })
75
-
76
- for await (const output of hf.textGenerationStream({
77
- model: "google/flan-t5-xxl",
78
- inputs: 'repeat "one two three four"',
79
- parameters: { max_new_tokens: 250 }
80
- })) {
81
- console.log(output.token.text, output.generated_text);
82
- }
83
- ```
84
-
85
- ### Text Generation (Chat Completion API Compatible)
86
-
87
- Using the `chatCompletion` method, you can generate text with models compatible with the OpenAI Chat Completion API. All models served by [TGI](https://api-inference.huggingface.co/framework/text-generation-inference) on Hugging Face support Messages API.
88
-
89
- [Demo](https://huggingface.co/spaces/huggingfacejs/streaming-chat-completion)
90
-
91
- ```typescript
92
- // Non-streaming API
93
- const out = await hf.chatCompletion({
94
- model: "mistralai/Mistral-7B-Instruct-v0.2",
95
- messages: [{ role: "user", content: "Complete the this sentence with words one plus one is equal " }],
96
- max_tokens: 500,
97
- temperature: 0.1,
98
- seed: 0,
99
- });
100
-
101
- // Streaming API
102
- let out = "";
103
- for await (const chunk of hf.chatCompletionStream({
104
- model: "mistralai/Mistral-7B-Instruct-v0.2",
105
- messages: [
106
- { role: "user", content: "Complete the equation 1+1= ,just the answer" },
107
- ],
108
- max_tokens: 500,
109
- temperature: 0.1,
110
- seed: 0,
111
- })) {
112
- if (chunk.choices && chunk.choices.length > 0) {
113
- out += chunk.choices[0].delta.content;
114
- }
115
- }
116
- ```
117
-
118
- It's also possible to call Mistral or OpenAI endpoints directly:
119
-
120
- ```typescript
121
- const openai = new HfInference(OPENAI_TOKEN).endpoint("https://api.openai.com");
122
-
123
- let out = "";
124
- for await (const chunk of openai.chatCompletionStream({
125
- model: "gpt-3.5-turbo",
126
- messages: [
127
- { role: "user", content: "Complete the equation 1+1= ,just the answer" },
128
- ],
129
- max_tokens: 500,
130
- temperature: 0.1,
131
- seed: 0,
132
- })) {
133
- if (chunk.choices && chunk.choices.length > 0) {
134
- out += chunk.choices[0].delta.content;
135
- }
136
- }
137
-
138
- // For mistral AI:
139
- // endpointUrl: "https://api.mistral.ai"
140
- // model: "mistral-tiny"
141
- ```
142
-
143
- ### Fill Mask
144
-
145
- Tries to fill in a hole with a missing word (token to be precise).
146
-
147
- ```typescript
148
- await hf.fillMask({
149
- model: 'bert-base-uncased',
150
- inputs: '[MASK] world!'
151
- })
152
- ```
153
-
154
- ### Summarization
155
-
156
- Summarizes longer text into shorter text. Be careful, some models have a maximum length of input.
157
-
158
- ```typescript
159
- await hf.summarization({
160
- model: 'facebook/bart-large-cnn',
161
- inputs:
162
- 'The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930.',
163
- parameters: {
164
- max_length: 100
165
- }
166
- })
167
- ```
168
-
169
- ### Question Answering
170
-
171
- Answers questions based on the context you provide.
172
-
173
- ```typescript
174
- await hf.questionAnswering({
175
- model: 'deepset/roberta-base-squad2',
176
- inputs: {
177
- question: 'What is the capital of France?',
178
- context: 'The capital of France is Paris.'
179
- }
180
- })
181
- ```
182
-
183
- ### Table Question Answering
184
-
185
- ```typescript
186
- await hf.tableQuestionAnswering({
187
- model: 'google/tapas-base-finetuned-wtq',
188
- inputs: {
189
- query: 'How many stars does the transformers repository have?',
190
- table: {
191
- Repository: ['Transformers', 'Datasets', 'Tokenizers'],
192
- Stars: ['36542', '4512', '3934'],
193
- Contributors: ['651', '77', '34'],
194
- 'Programming language': ['Python', 'Python', 'Rust, Python and NodeJS']
195
- }
196
- }
197
- })
198
- ```
199
-
200
- ### Text Classification
201
-
202
- Often used for sentiment analysis, this method will assign labels to the given text along with a probability score of that label.
203
-
204
- ```typescript
205
- await hf.textClassification({
206
- model: 'distilbert-base-uncased-finetuned-sst-2-english',
207
- inputs: 'I like you. I love you.'
208
- })
209
- ```
210
-
211
- ### Token Classification
212
-
213
- Used for sentence parsing, either grammatical, or Named Entity Recognition (NER) to understand keywords contained within text.
214
-
215
- ```typescript
216
- await hf.tokenClassification({
217
- model: 'dbmdz/bert-large-cased-finetuned-conll03-english',
218
- inputs: 'My name is Sarah Jessica Parker but you can call me Jessica'
219
- })
220
- ```
221
-
222
- ### Translation
223
-
224
- Converts text from one language to another.
225
-
226
- ```typescript
227
- await hf.translation({
228
- model: 't5-base',
229
- inputs: 'My name is Wolfgang and I live in Berlin'
230
- })
231
-
232
- await hf.translation({
233
- model: 'facebook/mbart-large-50-many-to-many-mmt',
234
- inputs: textToTranslate,
235
- parameters: {
236
- "src_lang": "en_XX",
237
- "tgt_lang": "fr_XX"
238
- }
239
- })
240
- ```
241
-
242
- ### Zero-Shot Classification
243
-
244
- Checks how well an input text fits into a set of labels you provide.
245
-
246
- ```typescript
247
- await hf.zeroShotClassification({
248
- model: 'facebook/bart-large-mnli',
249
- inputs: [
250
- 'Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!'
251
- ],
252
- parameters: { candidate_labels: ['refund', 'legal', 'faq'] }
253
- })
254
- ```
255
-
256
- ### Conversational
257
-
258
- This task corresponds to any chatbot-like structure. Models tend to have shorter max_length, so please check with caution when using a given model if you need long-range dependency or not.
259
-
260
- ```typescript
261
- await hf.conversational({
262
- model: 'microsoft/DialoGPT-large',
263
- inputs: {
264
- past_user_inputs: ['Which movie is the best ?'],
265
- generated_responses: ['It is Die Hard for sure.'],
266
- text: 'Can you explain why ?'
267
- }
268
- })
269
- ```
270
-
271
- ### Sentence Similarity
272
-
273
- Calculate the semantic similarity between one text and a list of other sentences.
274
-
275
- ```typescript
276
- await hf.sentenceSimilarity({
277
- model: 'sentence-transformers/paraphrase-xlm-r-multilingual-v1',
278
- inputs: {
279
- source_sentence: 'That is a happy person',
280
- sentences: [
281
- 'That is a happy dog',
282
- 'That is a very happy person',
283
- 'Today is a sunny day'
284
- ]
285
- }
286
- })
287
- ```
288
-
289
- ## Audio
290
-
291
- ### Automatic Speech Recognition
292
-
293
- Transcribes speech from an audio file.
294
-
295
- [Demo](https://huggingface.co/spaces/huggingfacejs/speech-recognition-vue)
296
-
297
- ```typescript
298
- await hf.automaticSpeechRecognition({
299
- model: 'facebook/wav2vec2-large-960h-lv60-self',
300
- data: readFileSync('test/sample1.flac')
301
- })
302
- ```
303
-
304
- ### Audio Classification
305
-
306
- Assigns labels to the given audio along with a probability score of that label.
307
-
308
- [Demo](https://huggingface.co/spaces/huggingfacejs/audio-classification-vue)
309
-
310
- ```typescript
311
- await hf.audioClassification({
312
- model: 'superb/hubert-large-superb-er',
313
- data: readFileSync('test/sample1.flac')
314
- })
315
- ```
316
-
317
- ### Text To Speech
318
-
319
- Generates natural-sounding speech from text input.
320
-
321
- [Interactive tutorial](https://scrimba.com/scrim/co8da4d23b49b648f77f4848a?pl=pkVnrP7uP)
322
-
323
- ```typescript
324
- await hf.textToSpeech({
325
- model: 'espnet/kan-bayashi_ljspeech_vits',
326
- inputs: 'Hello world!'
327
- })
328
- ```
329
-
330
- ### Audio To Audio
331
-
332
- Outputs one or multiple generated audios from an input audio, commonly used for speech enhancement and source separation.
333
-
334
- ```typescript
335
- await hf.audioToAudio({
336
- model: 'speechbrain/sepformer-wham',
337
- data: readFileSync('test/sample1.flac')
338
- })
339
- ```
340
-
341
- ## Computer Vision
342
-
343
- ### Image Classification
344
-
345
- Assigns labels to a given image along with a probability score of that label.
346
-
347
- [Demo](https://huggingface.co/spaces/huggingfacejs/image-classification-vue)
348
-
349
- ```typescript
350
- await hf.imageClassification({
351
- data: readFileSync('test/cheetah.png'),
352
- model: 'google/vit-base-patch16-224'
353
- })
354
- ```
355
-
356
- ### Object Detection
357
-
358
- Detects objects within an image and returns labels with corresponding bounding boxes and probability scores.
359
-
360
- [Demo](https://huggingface.co/spaces/huggingfacejs/object-detection-vue)
361
-
362
- ```typescript
363
- await hf.objectDetection({
364
- data: readFileSync('test/cats.png'),
365
- model: 'facebook/detr-resnet-50'
366
- })
367
- ```
368
-
369
- ### Image Segmentation
370
-
371
- Detects segments within an image and returns labels with corresponding bounding boxes and probability scores.
372
-
373
- ```typescript
374
- await hf.imageSegmentation({
375
- data: readFileSync('test/cats.png'),
376
- model: 'facebook/detr-resnet-50-panoptic'
377
- })
378
- ```
379
-
380
- ### Image To Text
381
-
382
- Outputs text from a given image, commonly used for captioning or optical character recognition.
383
-
384
- ```typescript
385
- await hf.imageToText({
386
- data: readFileSync('test/cats.png'),
387
- model: 'nlpconnect/vit-gpt2-image-captioning'
388
- })
389
- ```
390
-
391
- ### Text To Image
392
-
393
- Creates an image from a text prompt.
394
-
395
- [Demo](https://huggingface.co/spaces/huggingfacejs/image-to-text)
396
-
397
- ```typescript
398
- await hf.textToImage({
399
- inputs: 'award winning high resolution photo of a giant tortoise/((ladybird)) hybrid, [trending on artstation]',
400
- model: 'stabilityai/stable-diffusion-2',
401
- parameters: {
402
- negative_prompt: 'blurry',
403
- }
404
- })
405
- ```
406
-
407
- ### Image To Image
408
-
409
- Image-to-image is the task of transforming a source image to match the characteristics of a target image or a target image domain.
410
-
411
- [Interactive tutorial](https://scrimba.com/scrim/co4834bf9a91cc81cfab07969?pl=pkVnrP7uP)
412
-
413
- ```typescript
414
- await hf.imageToImage({
415
- inputs: new Blob([readFileSync("test/stormtrooper_depth.png")]),
416
- parameters: {
417
- prompt: "elmo's lecture",
418
- },
419
- model: "lllyasviel/sd-controlnet-depth",
420
- });
421
- ```
422
-
423
- ### Zero Shot Image Classification
424
-
425
- Checks how well an input image fits into a set of labels you provide.
426
-
427
- ```typescript
428
- await hf.zeroShotImageClassification({
429
- model: 'openai/clip-vit-large-patch14-336',
430
- inputs: {
431
- image: await (await fetch('https://placekitten.com/300/300')).blob()
432
- },
433
- parameters: {
434
- candidate_labels: ['cat', 'dog']
435
- }
436
- })
437
- ```
438
-
439
- ## Multimodal
440
-
441
- ### Feature Extraction
442
-
443
- This task reads some text and outputs raw float values, that are usually consumed as part of a semantic database/semantic search.
444
-
445
- ```typescript
446
- await hf.featureExtraction({
447
- model: "sentence-transformers/distilbert-base-nli-mean-tokens",
448
- inputs: "That is a happy person",
449
- });
450
- ```
451
-
452
- ### Visual Question Answering
453
-
454
- Visual Question Answering is the task of answering open-ended questions based on an image. They output natural language responses to natural language questions.
455
-
456
- [Demo](https://huggingface.co/spaces/huggingfacejs/doc-vis-qa)
457
-
458
- ```typescript
459
- await hf.visualQuestionAnswering({
460
- model: 'dandelin/vilt-b32-finetuned-vqa',
461
- inputs: {
462
- question: 'How many cats are lying down?',
463
- image: await (await fetch('https://placekitten.com/300/300')).blob()
464
- }
465
- })
466
- ```
467
-
468
- ### Document Question Answering
469
-
470
- Document question answering models take a (document, question) pair as input and return an answer in natural language.
471
-
472
- [Demo](https://huggingface.co/spaces/huggingfacejs/doc-vis-qa)
473
-
474
- ```typescript
475
- await hf.documentQuestionAnswering({
476
- model: 'impira/layoutlm-document-qa',
477
- inputs: {
478
- question: 'Invoice number?',
479
- image: await (await fetch('https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png')).blob(),
480
- }
481
- })
482
- ```
483
-
484
- ## Tabular
485
-
486
- ### Tabular Regression
487
-
488
- Tabular regression is the task of predicting a numerical value given a set of attributes.
489
-
490
- ```typescript
491
- await hf.tabularRegression({
492
- model: "scikit-learn/Fish-Weight",
493
- inputs: {
494
- data: {
495
- "Height": ["11.52", "12.48", "12.3778"],
496
- "Length1": ["23.2", "24", "23.9"],
497
- "Length2": ["25.4", "26.3", "26.5"],
498
- "Length3": ["30", "31.2", "31.1"],
499
- "Species": ["Bream", "Bream", "Bream"],
500
- "Width": ["4.02", "4.3056", "4.6961"]
501
- },
502
- },
503
- })
504
- ```
505
-
506
- ### Tabular Classification
507
-
508
- Tabular classification is the task of classifying a target category (a group) based on set of attributes.
509
-
510
- ```typescript
511
- await hf.tabularClassification({
512
- model: "vvmnnnkv/wine-quality",
513
- inputs: {
514
- data: {
515
- "fixed_acidity": ["7.4", "7.8", "10.3"],
516
- "volatile_acidity": ["0.7", "0.88", "0.32"],
517
- "citric_acid": ["0", "0", "0.45"],
518
- "residual_sugar": ["1.9", "2.6", "6.4"],
519
- "chlorides": ["0.076", "0.098", "0.073"],
520
- "free_sulfur_dioxide": ["11", "25", "5"],
521
- "total_sulfur_dioxide": ["34", "67", "13"],
522
- "density": ["0.9978", "0.9968", "0.9976"],
523
- "pH": ["3.51", "3.2", "3.23"],
524
- "sulphates": ["0.56", "0.68", "0.82"],
525
- "alcohol": ["9.4", "9.8", "12.6"]
526
- },
527
- },
528
- })
529
- ```
530
-
531
- ## Custom Calls
532
-
533
- For models with custom parameters / outputs.
534
-
535
- ```typescript
536
- await hf.request({
537
- model: 'my-custom-model',
538
- inputs: 'hello world',
539
- parameters: {
540
- custom_param: 'some magic',
541
- }
542
- })
543
-
544
- // Custom streaming call, for models with custom parameters / outputs
545
- for await (const output of hf.streamingRequest({
546
- model: 'my-custom-model',
547
- inputs: 'hello world',
548
- parameters: {
549
- custom_param: 'some magic',
550
- }
551
- })) {
552
- ...
553
- }
554
- ```
555
-
556
- You can use any Chat Completion API-compatible provider with the `chatCompletion` method.
557
-
558
- ```typescript
559
- // Chat Completion Example
560
- const MISTRAL_KEY = process.env.MISTRAL_KEY;
561
- const hf = new HfInference(MISTRAL_KEY);
562
- const ep = hf.endpoint("https://api.mistral.ai");
563
- const stream = ep.chatCompletionStream({
564
- model: "mistral-tiny",
565
- messages: [{ role: "user", content: "Complete the equation one + one = , just the answer" }],
566
- });
567
- let out = "";
568
- for await (const chunk of stream) {
569
- if (chunk.choices && chunk.choices.length > 0) {
570
- out += chunk.choices[0].delta.content;
571
- console.log(out);
572
- }
573
- }
574
- ```
575
-
576
- ## Custom Inference Endpoints
577
-
578
- Learn more about using your own inference endpoints [here](https://hf.co/docs/inference-endpoints/)
579
-
580
- ```typescript
581
- const gpt2 = hf.endpoint('https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2');
582
- const { generated_text } = await gpt2.textGeneration({inputs: 'The answer to the universe is'});
583
-
584
- // Chat Completion Example
585
- const ep = hf.endpoint(
586
- "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2"
587
- );
588
- const stream = ep.chatCompletionStream({
589
- model: "tgi",
590
- messages: [{ role: "user", content: "Complete the equation 1+1= ,just the answer" }],
591
- max_tokens: 500,
592
- temperature: 0.1,
593
- seed: 0,
594
- });
595
- let out = "";
596
- for await (const chunk of stream) {
597
- if (chunk.choices && chunk.choices.length > 0) {
598
- out += chunk.choices[0].delta.content;
599
- console.log(out);
600
- }
601
- }
602
- ```
603
-
604
- By default, all calls to the inference endpoint will wait until the model is
605
- loaded. When [scaling to
606
- 0](https://huggingface.co/docs/inference-endpoints/en/autoscaling#scaling-to-0)
607
- is enabled on the endpoint, this can result in non-trivial waiting time. If
608
- you'd rather disable this behavior and handle the endpoint's returned 500 HTTP
609
- errors yourself, you can do so like so:
610
-
611
- ```typescript
612
- const gpt2 = hf.endpoint('https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2');
613
- const { generated_text } = await gpt2.textGeneration(
614
- {inputs: 'The answer to the universe is'},
615
- {retry_on_error: false},
616
- );
617
- ```
618
-
619
- ## Running tests
620
-
621
- ```console
622
- HF_TOKEN="your access token" pnpm run test
623
- ```
624
-
625
- ## Finding appropriate models
626
-
627
- We have an informative documentation project called [Tasks](https://huggingface.co/tasks) to list available models for each task and explain how each task works in detail.
628
-
629
- It also contains demos, example outputs, and other resources should you want to dig deeper into the ML side of things.
630
-
631
- ## Dependencies
632
-
633
- - `@huggingface/tasks` : Typings only
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/index.cjs DELETED
@@ -1,999 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- HfInference: () => HfInference,
24
- HfInferenceEndpoint: () => HfInferenceEndpoint,
25
- InferenceOutputError: () => InferenceOutputError,
26
- audioClassification: () => audioClassification,
27
- audioToAudio: () => audioToAudio,
28
- automaticSpeechRecognition: () => automaticSpeechRecognition,
29
- chatCompletion: () => chatCompletion,
30
- chatCompletionStream: () => chatCompletionStream,
31
- documentQuestionAnswering: () => documentQuestionAnswering,
32
- featureExtraction: () => featureExtraction,
33
- fillMask: () => fillMask,
34
- imageClassification: () => imageClassification,
35
- imageSegmentation: () => imageSegmentation,
36
- imageToImage: () => imageToImage,
37
- imageToText: () => imageToText,
38
- objectDetection: () => objectDetection,
39
- questionAnswering: () => questionAnswering,
40
- request: () => request,
41
- sentenceSimilarity: () => sentenceSimilarity,
42
- streamingRequest: () => streamingRequest,
43
- summarization: () => summarization,
44
- tableQuestionAnswering: () => tableQuestionAnswering,
45
- tabularClassification: () => tabularClassification,
46
- tabularRegression: () => tabularRegression,
47
- textClassification: () => textClassification,
48
- textGeneration: () => textGeneration,
49
- textGenerationStream: () => textGenerationStream,
50
- textToImage: () => textToImage,
51
- textToSpeech: () => textToSpeech,
52
- tokenClassification: () => tokenClassification,
53
- translation: () => translation,
54
- visualQuestionAnswering: () => visualQuestionAnswering,
55
- zeroShotClassification: () => zeroShotClassification,
56
- zeroShotImageClassification: () => zeroShotImageClassification
57
- });
58
- module.exports = __toCommonJS(src_exports);
59
-
60
- // src/tasks/index.ts
61
- var tasks_exports = {};
62
- __export(tasks_exports, {
63
- audioClassification: () => audioClassification,
64
- audioToAudio: () => audioToAudio,
65
- automaticSpeechRecognition: () => automaticSpeechRecognition,
66
- chatCompletion: () => chatCompletion,
67
- chatCompletionStream: () => chatCompletionStream,
68
- documentQuestionAnswering: () => documentQuestionAnswering,
69
- featureExtraction: () => featureExtraction,
70
- fillMask: () => fillMask,
71
- imageClassification: () => imageClassification,
72
- imageSegmentation: () => imageSegmentation,
73
- imageToImage: () => imageToImage,
74
- imageToText: () => imageToText,
75
- objectDetection: () => objectDetection,
76
- questionAnswering: () => questionAnswering,
77
- request: () => request,
78
- sentenceSimilarity: () => sentenceSimilarity,
79
- streamingRequest: () => streamingRequest,
80
- summarization: () => summarization,
81
- tableQuestionAnswering: () => tableQuestionAnswering,
82
- tabularClassification: () => tabularClassification,
83
- tabularRegression: () => tabularRegression,
84
- textClassification: () => textClassification,
85
- textGeneration: () => textGeneration,
86
- textGenerationStream: () => textGenerationStream,
87
- textToImage: () => textToImage,
88
- textToSpeech: () => textToSpeech,
89
- tokenClassification: () => tokenClassification,
90
- translation: () => translation,
91
- visualQuestionAnswering: () => visualQuestionAnswering,
92
- zeroShotClassification: () => zeroShotClassification,
93
- zeroShotImageClassification: () => zeroShotImageClassification
94
- });
95
-
96
- // src/utils/pick.ts
97
- function pick(o, props) {
98
- return Object.assign(
99
- {},
100
- ...props.map((prop) => {
101
- if (o[prop] !== void 0) {
102
- return { [prop]: o[prop] };
103
- }
104
- })
105
- );
106
- }
107
-
108
- // src/utils/typedInclude.ts
109
- function typedInclude(arr, v) {
110
- return arr.includes(v);
111
- }
112
-
113
- // src/utils/omit.ts
114
- function omit(o, props) {
115
- const propsArr = Array.isArray(props) ? props : [props];
116
- const letsKeep = Object.keys(o).filter((prop) => !typedInclude(propsArr, prop));
117
- return pick(o, letsKeep);
118
- }
119
-
120
- // src/lib/isUrl.ts
121
- function isUrl(modelOrUrl) {
122
- return /^http(s?):/.test(modelOrUrl) || modelOrUrl.startsWith("/");
123
- }
124
-
125
- // src/lib/getDefaultTask.ts
126
- var taskCache = /* @__PURE__ */ new Map();
127
- var CACHE_DURATION = 10 * 60 * 1e3;
128
- var MAX_CACHE_ITEMS = 1e3;
129
- var HF_HUB_URL = "https://huggingface.co";
130
- async function getDefaultTask(model, accessToken, options) {
131
- if (isUrl(model)) {
132
- return null;
133
- }
134
- const key = `${model}:${accessToken}`;
135
- let cachedTask = taskCache.get(key);
136
- if (cachedTask && cachedTask.date < new Date(Date.now() - CACHE_DURATION)) {
137
- taskCache.delete(key);
138
- cachedTask = void 0;
139
- }
140
- if (cachedTask === void 0) {
141
- const modelTask = await (options?.fetch ?? fetch)(`${HF_HUB_URL}/api/models/${model}?expand[]=pipeline_tag`, {
142
- headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}
143
- }).then((resp) => resp.json()).then((json) => json.pipeline_tag).catch(() => null);
144
- if (!modelTask) {
145
- return null;
146
- }
147
- cachedTask = { task: modelTask, date: /* @__PURE__ */ new Date() };
148
- taskCache.set(key, { task: modelTask, date: /* @__PURE__ */ new Date() });
149
- if (taskCache.size > MAX_CACHE_ITEMS) {
150
- taskCache.delete(taskCache.keys().next().value);
151
- }
152
- }
153
- return cachedTask.task;
154
- }
155
-
156
- // src/lib/makeRequestOptions.ts
157
- var HF_INFERENCE_API_BASE_URL = "https://api-inference.huggingface.co";
158
- var tasks = null;
159
- async function makeRequestOptions(args, options) {
160
- const { accessToken, endpointUrl, ...otherArgs } = args;
161
- let { model } = args;
162
- const {
163
- forceTask: task,
164
- includeCredentials,
165
- taskHint,
166
- wait_for_model,
167
- use_cache,
168
- dont_load_model,
169
- chatCompletion: chatCompletion2
170
- } = options ?? {};
171
- const headers = {};
172
- if (accessToken) {
173
- headers["Authorization"] = `Bearer ${accessToken}`;
174
- }
175
- if (!model && !tasks && taskHint) {
176
- const res = await fetch(`${HF_HUB_URL}/api/tasks`);
177
- if (res.ok) {
178
- tasks = await res.json();
179
- }
180
- }
181
- if (!model && tasks && taskHint) {
182
- const taskInfo = tasks[taskHint];
183
- if (taskInfo) {
184
- model = taskInfo.models[0].id;
185
- }
186
- }
187
- if (!model) {
188
- throw new Error("No model provided, and no default model found for this task");
189
- }
190
- const binary = "data" in args && !!args.data;
191
- if (!binary) {
192
- headers["Content-Type"] = "application/json";
193
- }
194
- if (wait_for_model) {
195
- headers["X-Wait-For-Model"] = "true";
196
- }
197
- if (use_cache === false) {
198
- headers["X-Use-Cache"] = "false";
199
- }
200
- if (dont_load_model) {
201
- headers["X-Load-Model"] = "0";
202
- }
203
- let url = (() => {
204
- if (endpointUrl && isUrl(model)) {
205
- throw new TypeError("Both model and endpointUrl cannot be URLs");
206
- }
207
- if (isUrl(model)) {
208
- console.warn("Using a model URL is deprecated, please use the `endpointUrl` parameter instead");
209
- return model;
210
- }
211
- if (endpointUrl) {
212
- return endpointUrl;
213
- }
214
- if (task) {
215
- return `${HF_INFERENCE_API_BASE_URL}/pipeline/${task}/${model}`;
216
- }
217
- return `${HF_INFERENCE_API_BASE_URL}/models/${model}`;
218
- })();
219
- if (chatCompletion2 && !url.endsWith("/chat/completions")) {
220
- url += "/v1/chat/completions";
221
- }
222
- let credentials;
223
- if (typeof includeCredentials === "string") {
224
- credentials = includeCredentials;
225
- } else if (includeCredentials === true) {
226
- credentials = "include";
227
- }
228
- const info = {
229
- headers,
230
- method: "POST",
231
- body: binary ? args.data : JSON.stringify({
232
- ...otherArgs.model && isUrl(otherArgs.model) ? omit(otherArgs, "model") : otherArgs
233
- }),
234
- ...credentials && { credentials },
235
- signal: options?.signal
236
- };
237
- return { url, info };
238
- }
239
-
240
- // src/tasks/custom/request.ts
241
- async function request(args, options) {
242
- const { url, info } = await makeRequestOptions(args, options);
243
- const response = await (options?.fetch ?? fetch)(url, info);
244
- if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
245
- return request(args, {
246
- ...options,
247
- wait_for_model: true
248
- });
249
- }
250
- if (!response.ok) {
251
- if (response.headers.get("Content-Type")?.startsWith("application/json")) {
252
- const output = await response.json();
253
- if ([400, 422, 404, 500].includes(response.status) && options?.chatCompletion) {
254
- throw new Error(`Server ${args.model} does not seem to support chat completion. Error: ${output.error}`);
255
- }
256
- if (output.error) {
257
- throw new Error(output.error);
258
- }
259
- }
260
- throw new Error("An error occurred while fetching the blob");
261
- }
262
- if (response.headers.get("Content-Type")?.startsWith("application/json")) {
263
- return await response.json();
264
- }
265
- return await response.blob();
266
- }
267
-
268
- // src/vendor/fetch-event-source/parse.ts
269
- function getLines(onLine) {
270
- let buffer;
271
- let position;
272
- let fieldLength;
273
- let discardTrailingNewline = false;
274
- return function onChunk(arr) {
275
- if (buffer === void 0) {
276
- buffer = arr;
277
- position = 0;
278
- fieldLength = -1;
279
- } else {
280
- buffer = concat(buffer, arr);
281
- }
282
- const bufLength = buffer.length;
283
- let lineStart = 0;
284
- while (position < bufLength) {
285
- if (discardTrailingNewline) {
286
- if (buffer[position] === 10 /* NewLine */) {
287
- lineStart = ++position;
288
- }
289
- discardTrailingNewline = false;
290
- }
291
- let lineEnd = -1;
292
- for (; position < bufLength && lineEnd === -1; ++position) {
293
- switch (buffer[position]) {
294
- case 58 /* Colon */:
295
- if (fieldLength === -1) {
296
- fieldLength = position - lineStart;
297
- }
298
- break;
299
- case 13 /* CarriageReturn */:
300
- discardTrailingNewline = true;
301
- case 10 /* NewLine */:
302
- lineEnd = position;
303
- break;
304
- }
305
- }
306
- if (lineEnd === -1) {
307
- break;
308
- }
309
- onLine(buffer.subarray(lineStart, lineEnd), fieldLength);
310
- lineStart = position;
311
- fieldLength = -1;
312
- }
313
- if (lineStart === bufLength) {
314
- buffer = void 0;
315
- } else if (lineStart !== 0) {
316
- buffer = buffer.subarray(lineStart);
317
- position -= lineStart;
318
- }
319
- };
320
- }
321
- function getMessages(onId, onRetry, onMessage) {
322
- let message = newMessage();
323
- const decoder = new TextDecoder();
324
- return function onLine(line, fieldLength) {
325
- if (line.length === 0) {
326
- onMessage?.(message);
327
- message = newMessage();
328
- } else if (fieldLength > 0) {
329
- const field = decoder.decode(line.subarray(0, fieldLength));
330
- const valueOffset = fieldLength + (line[fieldLength + 1] === 32 /* Space */ ? 2 : 1);
331
- const value = decoder.decode(line.subarray(valueOffset));
332
- switch (field) {
333
- case "data":
334
- message.data = message.data ? message.data + "\n" + value : value;
335
- break;
336
- case "event":
337
- message.event = value;
338
- break;
339
- case "id":
340
- onId(message.id = value);
341
- break;
342
- case "retry":
343
- const retry = parseInt(value, 10);
344
- if (!isNaN(retry)) {
345
- onRetry(message.retry = retry);
346
- }
347
- break;
348
- }
349
- }
350
- };
351
- }
352
- function concat(a, b) {
353
- const res = new Uint8Array(a.length + b.length);
354
- res.set(a);
355
- res.set(b, a.length);
356
- return res;
357
- }
358
- function newMessage() {
359
- return {
360
- data: "",
361
- event: "",
362
- id: "",
363
- retry: void 0
364
- };
365
- }
366
-
367
- // src/tasks/custom/streamingRequest.ts
368
- async function* streamingRequest(args, options) {
369
- const { url, info } = await makeRequestOptions({ ...args, stream: true }, options);
370
- const response = await (options?.fetch ?? fetch)(url, info);
371
- if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
372
- return yield* streamingRequest(args, {
373
- ...options,
374
- wait_for_model: true
375
- });
376
- }
377
- if (!response.ok) {
378
- if (response.headers.get("Content-Type")?.startsWith("application/json")) {
379
- const output = await response.json();
380
- if ([400, 422, 404, 500].includes(response.status) && options?.chatCompletion) {
381
- throw new Error(`Server ${args.model} does not seem to support chat completion. Error: ${output.error}`);
382
- }
383
- if (output.error) {
384
- throw new Error(output.error);
385
- }
386
- }
387
- throw new Error(`Server response contains error: ${response.status}`);
388
- }
389
- if (!response.headers.get("content-type")?.startsWith("text/event-stream")) {
390
- throw new Error(
391
- `Server does not support event stream content type, it returned ` + response.headers.get("content-type")
392
- );
393
- }
394
- if (!response.body) {
395
- return;
396
- }
397
- const reader = response.body.getReader();
398
- let events = [];
399
- const onEvent = (event) => {
400
- events.push(event);
401
- };
402
- const onChunk = getLines(
403
- getMessages(
404
- () => {
405
- },
406
- () => {
407
- },
408
- onEvent
409
- )
410
- );
411
- try {
412
- while (true) {
413
- const { done, value } = await reader.read();
414
- if (done)
415
- return;
416
- onChunk(value);
417
- for (const event of events) {
418
- if (event.data.length > 0) {
419
- if (event.data === "[DONE]") {
420
- return;
421
- }
422
- const data = JSON.parse(event.data);
423
- if (typeof data === "object" && data !== null && "error" in data) {
424
- throw new Error(data.error);
425
- }
426
- yield data;
427
- }
428
- }
429
- events = [];
430
- }
431
- } finally {
432
- reader.releaseLock();
433
- }
434
- }
435
-
436
- // src/lib/InferenceOutputError.ts
437
- var InferenceOutputError = class extends TypeError {
438
- constructor(message) {
439
- super(
440
- `Invalid inference output: ${message}. Use the 'request' method with the same parameters to do a custom call with no type checking.`
441
- );
442
- this.name = "InferenceOutputError";
443
- }
444
- };
445
-
446
- // src/tasks/audio/audioClassification.ts
447
- async function audioClassification(args, options) {
448
- const res = await request(args, {
449
- ...options,
450
- taskHint: "audio-classification"
451
- });
452
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.score === "number");
453
- if (!isValidOutput) {
454
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
455
- }
456
- return res;
457
- }
458
-
459
- // src/tasks/audio/automaticSpeechRecognition.ts
460
- async function automaticSpeechRecognition(args, options) {
461
- const res = await request(args, {
462
- ...options,
463
- taskHint: "automatic-speech-recognition"
464
- });
465
- const isValidOutput = typeof res?.text === "string";
466
- if (!isValidOutput) {
467
- throw new InferenceOutputError("Expected {text: string}");
468
- }
469
- return res;
470
- }
471
-
472
- // src/tasks/audio/textToSpeech.ts
473
- async function textToSpeech(args, options) {
474
- const res = await request(args, {
475
- ...options,
476
- taskHint: "text-to-speech"
477
- });
478
- const isValidOutput = res && res instanceof Blob;
479
- if (!isValidOutput) {
480
- throw new InferenceOutputError("Expected Blob");
481
- }
482
- return res;
483
- }
484
-
485
- // src/tasks/audio/audioToAudio.ts
486
- async function audioToAudio(args, options) {
487
- const res = await request(args, {
488
- ...options,
489
- taskHint: "audio-to-audio"
490
- });
491
- const isValidOutput = Array.isArray(res) && res.every(
492
- (x) => typeof x.label === "string" && typeof x.blob === "string" && typeof x["content-type"] === "string"
493
- );
494
- if (!isValidOutput) {
495
- throw new InferenceOutputError("Expected Array<{label: string, blob: string, content-type: string}>");
496
- }
497
- return res;
498
- }
499
-
500
- // src/tasks/cv/imageClassification.ts
501
- async function imageClassification(args, options) {
502
- const res = await request(args, {
503
- ...options,
504
- taskHint: "image-classification"
505
- });
506
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.score === "number");
507
- if (!isValidOutput) {
508
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
509
- }
510
- return res;
511
- }
512
-
513
- // src/tasks/cv/imageSegmentation.ts
514
- async function imageSegmentation(args, options) {
515
- const res = await request(args, {
516
- ...options,
517
- taskHint: "image-segmentation"
518
- });
519
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.mask === "string" && typeof x.score === "number");
520
- if (!isValidOutput) {
521
- throw new InferenceOutputError("Expected Array<{label: string, mask: string, score: number}>");
522
- }
523
- return res;
524
- }
525
-
526
- // src/tasks/cv/imageToText.ts
527
- async function imageToText(args, options) {
528
- const res = (await request(args, {
529
- ...options,
530
- taskHint: "image-to-text"
531
- }))?.[0];
532
- if (typeof res?.generated_text !== "string") {
533
- throw new InferenceOutputError("Expected {generated_text: string}");
534
- }
535
- return res;
536
- }
537
-
538
- // src/tasks/cv/objectDetection.ts
539
- async function objectDetection(args, options) {
540
- const res = await request(args, {
541
- ...options,
542
- taskHint: "object-detection"
543
- });
544
- const isValidOutput = Array.isArray(res) && res.every(
545
- (x) => typeof x.label === "string" && typeof x.score === "number" && typeof x.box.xmin === "number" && typeof x.box.ymin === "number" && typeof x.box.xmax === "number" && typeof x.box.ymax === "number"
546
- );
547
- if (!isValidOutput) {
548
- throw new InferenceOutputError(
549
- "Expected Array<{label:string; score:number; box:{xmin:number; ymin:number; xmax:number; ymax:number}}>"
550
- );
551
- }
552
- return res;
553
- }
554
-
555
- // src/tasks/cv/textToImage.ts
556
- async function textToImage(args, options) {
557
- const res = await request(args, {
558
- ...options,
559
- taskHint: "text-to-image"
560
- });
561
- const isValidOutput = res && res instanceof Blob;
562
- if (!isValidOutput) {
563
- throw new InferenceOutputError("Expected Blob");
564
- }
565
- return res;
566
- }
567
-
568
- // src/utils/base64FromBytes.ts
569
- function base64FromBytes(arr) {
570
- if (globalThis.Buffer) {
571
- return globalThis.Buffer.from(arr).toString("base64");
572
- } else {
573
- const bin = [];
574
- arr.forEach((byte) => {
575
- bin.push(String.fromCharCode(byte));
576
- });
577
- return globalThis.btoa(bin.join(""));
578
- }
579
- }
580
-
581
- // src/tasks/cv/imageToImage.ts
582
- async function imageToImage(args, options) {
583
- let reqArgs;
584
- if (!args.parameters) {
585
- reqArgs = {
586
- accessToken: args.accessToken,
587
- model: args.model,
588
- data: args.inputs
589
- };
590
- } else {
591
- reqArgs = {
592
- ...args,
593
- inputs: base64FromBytes(
594
- new Uint8Array(args.inputs instanceof ArrayBuffer ? args.inputs : await args.inputs.arrayBuffer())
595
- )
596
- };
597
- }
598
- const res = await request(reqArgs, {
599
- ...options,
600
- taskHint: "image-to-image"
601
- });
602
- const isValidOutput = res && res instanceof Blob;
603
- if (!isValidOutput) {
604
- throw new InferenceOutputError("Expected Blob");
605
- }
606
- return res;
607
- }
608
-
609
- // src/tasks/cv/zeroShotImageClassification.ts
610
- async function zeroShotImageClassification(args, options) {
611
- const reqArgs = {
612
- ...args,
613
- inputs: {
614
- image: base64FromBytes(
615
- new Uint8Array(
616
- args.inputs.image instanceof ArrayBuffer ? args.inputs.image : await args.inputs.image.arrayBuffer()
617
- )
618
- )
619
- }
620
- };
621
- const res = await request(reqArgs, {
622
- ...options,
623
- taskHint: "zero-shot-image-classification"
624
- });
625
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.score === "number");
626
- if (!isValidOutput) {
627
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
628
- }
629
- return res;
630
- }
631
-
632
- // src/tasks/nlp/featureExtraction.ts
633
- async function featureExtraction(args, options) {
634
- const defaultTask = args.model ? await getDefaultTask(args.model, args.accessToken, options) : void 0;
635
- const res = await request(args, {
636
- ...options,
637
- taskHint: "feature-extraction",
638
- ...defaultTask === "sentence-similarity" && { forceTask: "feature-extraction" }
639
- });
640
- let isValidOutput = true;
641
- const isNumArrayRec = (arr, maxDepth, curDepth = 0) => {
642
- if (curDepth > maxDepth)
643
- return false;
644
- if (arr.every((x) => Array.isArray(x))) {
645
- return arr.every((x) => isNumArrayRec(x, maxDepth, curDepth + 1));
646
- } else {
647
- return arr.every((x) => typeof x === "number");
648
- }
649
- };
650
- isValidOutput = Array.isArray(res) && isNumArrayRec(res, 3, 0);
651
- if (!isValidOutput) {
652
- throw new InferenceOutputError("Expected Array<number[][][] | number[][] | number[] | number>");
653
- }
654
- return res;
655
- }
656
-
657
- // src/tasks/nlp/fillMask.ts
658
- async function fillMask(args, options) {
659
- const res = await request(args, {
660
- ...options,
661
- taskHint: "fill-mask"
662
- });
663
- const isValidOutput = Array.isArray(res) && res.every(
664
- (x) => typeof x.score === "number" && typeof x.sequence === "string" && typeof x.token === "number" && typeof x.token_str === "string"
665
- );
666
- if (!isValidOutput) {
667
- throw new InferenceOutputError(
668
- "Expected Array<{score: number, sequence: string, token: number, token_str: string}>"
669
- );
670
- }
671
- return res;
672
- }
673
-
674
- // src/tasks/nlp/questionAnswering.ts
675
- async function questionAnswering(args, options) {
676
- const res = await request(args, {
677
- ...options,
678
- taskHint: "question-answering"
679
- });
680
- const isValidOutput = typeof res === "object" && !!res && typeof res.answer === "string" && typeof res.end === "number" && typeof res.score === "number" && typeof res.start === "number";
681
- if (!isValidOutput) {
682
- throw new InferenceOutputError("Expected {answer: string, end: number, score: number, start: number}");
683
- }
684
- return res;
685
- }
686
-
687
- // src/tasks/nlp/sentenceSimilarity.ts
688
- async function sentenceSimilarity(args, options) {
689
- const defaultTask = args.model ? await getDefaultTask(args.model, args.accessToken, options) : void 0;
690
- const res = await request(args, {
691
- ...options,
692
- taskHint: "sentence-similarity",
693
- ...defaultTask === "feature-extraction" && { forceTask: "sentence-similarity" }
694
- });
695
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x === "number");
696
- if (!isValidOutput) {
697
- throw new InferenceOutputError("Expected number[]");
698
- }
699
- return res;
700
- }
701
-
702
- // src/tasks/nlp/summarization.ts
703
- async function summarization(args, options) {
704
- const res = await request(args, {
705
- ...options,
706
- taskHint: "summarization"
707
- });
708
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.summary_text === "string");
709
- if (!isValidOutput) {
710
- throw new InferenceOutputError("Expected Array<{summary_text: string}>");
711
- }
712
- return res?.[0];
713
- }
714
-
715
- // src/tasks/nlp/tableQuestionAnswering.ts
716
- async function tableQuestionAnswering(args, options) {
717
- const res = await request(args, {
718
- ...options,
719
- taskHint: "table-question-answering"
720
- });
721
- const isValidOutput = typeof res?.aggregator === "string" && typeof res.answer === "string" && Array.isArray(res.cells) && res.cells.every((x) => typeof x === "string") && Array.isArray(res.coordinates) && res.coordinates.every((coord) => Array.isArray(coord) && coord.every((x) => typeof x === "number"));
722
- if (!isValidOutput) {
723
- throw new InferenceOutputError(
724
- "Expected {aggregator: string, answer: string, cells: string[], coordinates: number[][]}"
725
- );
726
- }
727
- return res;
728
- }
729
-
730
- // src/tasks/nlp/textClassification.ts
731
- async function textClassification(args, options) {
732
- const res = (await request(args, {
733
- ...options,
734
- taskHint: "text-classification"
735
- }))?.[0];
736
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.label === "string" && typeof x.score === "number");
737
- if (!isValidOutput) {
738
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
739
- }
740
- return res;
741
- }
742
-
743
- // src/utils/toArray.ts
744
- function toArray(obj) {
745
- if (Array.isArray(obj)) {
746
- return obj;
747
- }
748
- return [obj];
749
- }
750
-
751
- // src/tasks/nlp/textGeneration.ts
752
- async function textGeneration(args, options) {
753
- const res = toArray(
754
- await request(args, {
755
- ...options,
756
- taskHint: "text-generation"
757
- })
758
- );
759
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.generated_text === "string");
760
- if (!isValidOutput) {
761
- throw new InferenceOutputError("Expected Array<{generated_text: string}>");
762
- }
763
- return res?.[0];
764
- }
765
-
766
- // src/tasks/nlp/textGenerationStream.ts
767
- async function* textGenerationStream(args, options) {
768
- yield* streamingRequest(args, {
769
- ...options,
770
- taskHint: "text-generation"
771
- });
772
- }
773
-
774
- // src/tasks/nlp/tokenClassification.ts
775
- async function tokenClassification(args, options) {
776
- const res = toArray(
777
- await request(args, {
778
- ...options,
779
- taskHint: "token-classification"
780
- })
781
- );
782
- const isValidOutput = Array.isArray(res) && res.every(
783
- (x) => typeof x.end === "number" && typeof x.entity_group === "string" && typeof x.score === "number" && typeof x.start === "number" && typeof x.word === "string"
784
- );
785
- if (!isValidOutput) {
786
- throw new InferenceOutputError(
787
- "Expected Array<{end: number, entity_group: string, score: number, start: number, word: string}>"
788
- );
789
- }
790
- return res;
791
- }
792
-
793
- // src/tasks/nlp/translation.ts
794
- async function translation(args, options) {
795
- const res = await request(args, {
796
- ...options,
797
- taskHint: "translation"
798
- });
799
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.translation_text === "string");
800
- if (!isValidOutput) {
801
- throw new InferenceOutputError("Expected type Array<{translation_text: string}>");
802
- }
803
- return res?.length === 1 ? res?.[0] : res;
804
- }
805
-
806
- // src/tasks/nlp/zeroShotClassification.ts
807
- async function zeroShotClassification(args, options) {
808
- const res = toArray(
809
- await request(args, {
810
- ...options,
811
- taskHint: "zero-shot-classification"
812
- })
813
- );
814
- const isValidOutput = Array.isArray(res) && res.every(
815
- (x) => Array.isArray(x.labels) && x.labels.every((_label) => typeof _label === "string") && Array.isArray(x.scores) && x.scores.every((_score) => typeof _score === "number") && typeof x.sequence === "string"
816
- );
817
- if (!isValidOutput) {
818
- throw new InferenceOutputError("Expected Array<{labels: string[], scores: number[], sequence: string}>");
819
- }
820
- return res;
821
- }
822
-
823
- // src/tasks/nlp/chatCompletion.ts
824
- async function chatCompletion(args, options) {
825
- const res = await request(args, {
826
- ...options,
827
- taskHint: "text-generation",
828
- chatCompletion: true
829
- });
830
- const isValidOutput = typeof res === "object" && Array.isArray(res?.choices) && typeof res?.created === "number" && typeof res?.id === "string" && typeof res?.model === "string" && typeof res?.system_fingerprint === "string" && typeof res?.usage === "object";
831
- if (!isValidOutput) {
832
- throw new InferenceOutputError("Expected ChatCompletionOutput");
833
- }
834
- return res;
835
- }
836
-
837
- // src/tasks/nlp/chatCompletionStream.ts
838
- async function* chatCompletionStream(args, options) {
839
- yield* streamingRequest(args, {
840
- ...options,
841
- taskHint: "text-generation",
842
- chatCompletion: true
843
- });
844
- }
845
-
846
- // src/tasks/multimodal/documentQuestionAnswering.ts
847
- async function documentQuestionAnswering(args, options) {
848
- const reqArgs = {
849
- ...args,
850
- inputs: {
851
- question: args.inputs.question,
852
- // convert Blob or ArrayBuffer to base64
853
- image: base64FromBytes(
854
- new Uint8Array(
855
- args.inputs.image instanceof ArrayBuffer ? args.inputs.image : await args.inputs.image.arrayBuffer()
856
- )
857
- )
858
- }
859
- };
860
- const res = toArray(
861
- await request(reqArgs, {
862
- ...options,
863
- taskHint: "document-question-answering"
864
- })
865
- )?.[0];
866
- const isValidOutput = typeof res?.answer === "string" && (typeof res.end === "number" || typeof res.end === "undefined") && (typeof res.score === "number" || typeof res.score === "undefined") && (typeof res.start === "number" || typeof res.start === "undefined");
867
- if (!isValidOutput) {
868
- throw new InferenceOutputError("Expected Array<{answer: string, end?: number, score?: number, start?: number}>");
869
- }
870
- return res;
871
- }
872
-
873
- // src/tasks/multimodal/visualQuestionAnswering.ts
874
- async function visualQuestionAnswering(args, options) {
875
- const reqArgs = {
876
- ...args,
877
- inputs: {
878
- question: args.inputs.question,
879
- // convert Blob or ArrayBuffer to base64
880
- image: base64FromBytes(
881
- new Uint8Array(
882
- args.inputs.image instanceof ArrayBuffer ? args.inputs.image : await args.inputs.image.arrayBuffer()
883
- )
884
- )
885
- }
886
- };
887
- const res = (await request(reqArgs, {
888
- ...options,
889
- taskHint: "visual-question-answering"
890
- }))?.[0];
891
- const isValidOutput = typeof res?.answer === "string" && typeof res.score === "number";
892
- if (!isValidOutput) {
893
- throw new InferenceOutputError("Expected Array<{answer: string, score: number}>");
894
- }
895
- return res;
896
- }
897
-
898
- // src/tasks/tabular/tabularRegression.ts
899
- async function tabularRegression(args, options) {
900
- const res = await request(args, {
901
- ...options,
902
- taskHint: "tabular-regression"
903
- });
904
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x === "number");
905
- if (!isValidOutput) {
906
- throw new InferenceOutputError("Expected number[]");
907
- }
908
- return res;
909
- }
910
-
911
- // src/tasks/tabular/tabularClassification.ts
912
- async function tabularClassification(args, options) {
913
- const res = await request(args, {
914
- ...options,
915
- taskHint: "tabular-classification"
916
- });
917
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x === "number");
918
- if (!isValidOutput) {
919
- throw new InferenceOutputError("Expected number[]");
920
- }
921
- return res;
922
- }
923
-
924
- // src/HfInference.ts
925
- var HfInference = class {
926
- accessToken;
927
- defaultOptions;
928
- constructor(accessToken = "", defaultOptions = {}) {
929
- this.accessToken = accessToken;
930
- this.defaultOptions = defaultOptions;
931
- for (const [name, fn] of Object.entries(tasks_exports)) {
932
- Object.defineProperty(this, name, {
933
- enumerable: false,
934
- value: (params, options) => (
935
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
936
- fn({ ...params, accessToken }, { ...defaultOptions, ...options })
937
- )
938
- });
939
- }
940
- }
941
- /**
942
- * Returns copy of HfInference tied to a specified endpoint.
943
- */
944
- endpoint(endpointUrl) {
945
- return new HfInferenceEndpoint(endpointUrl, this.accessToken, this.defaultOptions);
946
- }
947
- };
948
- var HfInferenceEndpoint = class {
949
- constructor(endpointUrl, accessToken = "", defaultOptions = {}) {
950
- accessToken;
951
- defaultOptions;
952
- for (const [name, fn] of Object.entries(tasks_exports)) {
953
- Object.defineProperty(this, name, {
954
- enumerable: false,
955
- value: (params, options) => (
956
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
957
- fn({ ...params, accessToken, endpointUrl }, { ...defaultOptions, ...options })
958
- )
959
- });
960
- }
961
- }
962
- };
963
- // Annotate the CommonJS export names for ESM import in node:
964
- 0 && (module.exports = {
965
- HfInference,
966
- HfInferenceEndpoint,
967
- InferenceOutputError,
968
- audioClassification,
969
- audioToAudio,
970
- automaticSpeechRecognition,
971
- chatCompletion,
972
- chatCompletionStream,
973
- documentQuestionAnswering,
974
- featureExtraction,
975
- fillMask,
976
- imageClassification,
977
- imageSegmentation,
978
- imageToImage,
979
- imageToText,
980
- objectDetection,
981
- questionAnswering,
982
- request,
983
- sentenceSimilarity,
984
- streamingRequest,
985
- summarization,
986
- tableQuestionAnswering,
987
- tabularClassification,
988
- tabularRegression,
989
- textClassification,
990
- textGeneration,
991
- textGenerationStream,
992
- textToImage,
993
- textToSpeech,
994
- tokenClassification,
995
- translation,
996
- visualQuestionAnswering,
997
- zeroShotClassification,
998
- zeroShotImageClassification
999
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/index.js DELETED
@@ -1,945 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
- // src/tasks/index.ts
8
- var tasks_exports = {};
9
- __export(tasks_exports, {
10
- audioClassification: () => audioClassification,
11
- audioToAudio: () => audioToAudio,
12
- automaticSpeechRecognition: () => automaticSpeechRecognition,
13
- chatCompletion: () => chatCompletion,
14
- chatCompletionStream: () => chatCompletionStream,
15
- documentQuestionAnswering: () => documentQuestionAnswering,
16
- featureExtraction: () => featureExtraction,
17
- fillMask: () => fillMask,
18
- imageClassification: () => imageClassification,
19
- imageSegmentation: () => imageSegmentation,
20
- imageToImage: () => imageToImage,
21
- imageToText: () => imageToText,
22
- objectDetection: () => objectDetection,
23
- questionAnswering: () => questionAnswering,
24
- request: () => request,
25
- sentenceSimilarity: () => sentenceSimilarity,
26
- streamingRequest: () => streamingRequest,
27
- summarization: () => summarization,
28
- tableQuestionAnswering: () => tableQuestionAnswering,
29
- tabularClassification: () => tabularClassification,
30
- tabularRegression: () => tabularRegression,
31
- textClassification: () => textClassification,
32
- textGeneration: () => textGeneration,
33
- textGenerationStream: () => textGenerationStream,
34
- textToImage: () => textToImage,
35
- textToSpeech: () => textToSpeech,
36
- tokenClassification: () => tokenClassification,
37
- translation: () => translation,
38
- visualQuestionAnswering: () => visualQuestionAnswering,
39
- zeroShotClassification: () => zeroShotClassification,
40
- zeroShotImageClassification: () => zeroShotImageClassification
41
- });
42
-
43
- // src/utils/pick.ts
44
- function pick(o, props) {
45
- return Object.assign(
46
- {},
47
- ...props.map((prop) => {
48
- if (o[prop] !== void 0) {
49
- return { [prop]: o[prop] };
50
- }
51
- })
52
- );
53
- }
54
-
55
- // src/utils/typedInclude.ts
56
- function typedInclude(arr, v) {
57
- return arr.includes(v);
58
- }
59
-
60
- // src/utils/omit.ts
61
- function omit(o, props) {
62
- const propsArr = Array.isArray(props) ? props : [props];
63
- const letsKeep = Object.keys(o).filter((prop) => !typedInclude(propsArr, prop));
64
- return pick(o, letsKeep);
65
- }
66
-
67
- // src/lib/isUrl.ts
68
- function isUrl(modelOrUrl) {
69
- return /^http(s?):/.test(modelOrUrl) || modelOrUrl.startsWith("/");
70
- }
71
-
72
- // src/lib/getDefaultTask.ts
73
- var taskCache = /* @__PURE__ */ new Map();
74
- var CACHE_DURATION = 10 * 60 * 1e3;
75
- var MAX_CACHE_ITEMS = 1e3;
76
- var HF_HUB_URL = "https://huggingface.co";
77
- async function getDefaultTask(model, accessToken, options) {
78
- if (isUrl(model)) {
79
- return null;
80
- }
81
- const key = `${model}:${accessToken}`;
82
- let cachedTask = taskCache.get(key);
83
- if (cachedTask && cachedTask.date < new Date(Date.now() - CACHE_DURATION)) {
84
- taskCache.delete(key);
85
- cachedTask = void 0;
86
- }
87
- if (cachedTask === void 0) {
88
- const modelTask = await (options?.fetch ?? fetch)(`${HF_HUB_URL}/api/models/${model}?expand[]=pipeline_tag`, {
89
- headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}
90
- }).then((resp) => resp.json()).then((json) => json.pipeline_tag).catch(() => null);
91
- if (!modelTask) {
92
- return null;
93
- }
94
- cachedTask = { task: modelTask, date: /* @__PURE__ */ new Date() };
95
- taskCache.set(key, { task: modelTask, date: /* @__PURE__ */ new Date() });
96
- if (taskCache.size > MAX_CACHE_ITEMS) {
97
- taskCache.delete(taskCache.keys().next().value);
98
- }
99
- }
100
- return cachedTask.task;
101
- }
102
-
103
- // src/lib/makeRequestOptions.ts
104
- var HF_INFERENCE_API_BASE_URL = "https://api-inference.huggingface.co";
105
- var tasks = null;
106
- async function makeRequestOptions(args, options) {
107
- const { accessToken, endpointUrl, ...otherArgs } = args;
108
- let { model } = args;
109
- const {
110
- forceTask: task,
111
- includeCredentials,
112
- taskHint,
113
- wait_for_model,
114
- use_cache,
115
- dont_load_model,
116
- chatCompletion: chatCompletion2
117
- } = options ?? {};
118
- const headers = {};
119
- if (accessToken) {
120
- headers["Authorization"] = `Bearer ${accessToken}`;
121
- }
122
- if (!model && !tasks && taskHint) {
123
- const res = await fetch(`${HF_HUB_URL}/api/tasks`);
124
- if (res.ok) {
125
- tasks = await res.json();
126
- }
127
- }
128
- if (!model && tasks && taskHint) {
129
- const taskInfo = tasks[taskHint];
130
- if (taskInfo) {
131
- model = taskInfo.models[0].id;
132
- }
133
- }
134
- if (!model) {
135
- throw new Error("No model provided, and no default model found for this task");
136
- }
137
- const binary = "data" in args && !!args.data;
138
- if (!binary) {
139
- headers["Content-Type"] = "application/json";
140
- }
141
- if (wait_for_model) {
142
- headers["X-Wait-For-Model"] = "true";
143
- }
144
- if (use_cache === false) {
145
- headers["X-Use-Cache"] = "false";
146
- }
147
- if (dont_load_model) {
148
- headers["X-Load-Model"] = "0";
149
- }
150
- let url = (() => {
151
- if (endpointUrl && isUrl(model)) {
152
- throw new TypeError("Both model and endpointUrl cannot be URLs");
153
- }
154
- if (isUrl(model)) {
155
- console.warn("Using a model URL is deprecated, please use the `endpointUrl` parameter instead");
156
- return model;
157
- }
158
- if (endpointUrl) {
159
- return endpointUrl;
160
- }
161
- if (task) {
162
- return `${HF_INFERENCE_API_BASE_URL}/pipeline/${task}/${model}`;
163
- }
164
- return `${HF_INFERENCE_API_BASE_URL}/models/${model}`;
165
- })();
166
- if (chatCompletion2 && !url.endsWith("/chat/completions")) {
167
- url += "/v1/chat/completions";
168
- }
169
- let credentials;
170
- if (typeof includeCredentials === "string") {
171
- credentials = includeCredentials;
172
- } else if (includeCredentials === true) {
173
- credentials = "include";
174
- }
175
- const info = {
176
- headers,
177
- method: "POST",
178
- body: binary ? args.data : JSON.stringify({
179
- ...otherArgs.model && isUrl(otherArgs.model) ? omit(otherArgs, "model") : otherArgs
180
- }),
181
- ...credentials && { credentials },
182
- signal: options?.signal
183
- };
184
- return { url, info };
185
- }
186
-
187
- // src/tasks/custom/request.ts
188
- async function request(args, options) {
189
- const { url, info } = await makeRequestOptions(args, options);
190
- const response = await (options?.fetch ?? fetch)(url, info);
191
- if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
192
- return request(args, {
193
- ...options,
194
- wait_for_model: true
195
- });
196
- }
197
- if (!response.ok) {
198
- if (response.headers.get("Content-Type")?.startsWith("application/json")) {
199
- const output = await response.json();
200
- if ([400, 422, 404, 500].includes(response.status) && options?.chatCompletion) {
201
- throw new Error(`Server ${args.model} does not seem to support chat completion. Error: ${output.error}`);
202
- }
203
- if (output.error) {
204
- throw new Error(output.error);
205
- }
206
- }
207
- throw new Error("An error occurred while fetching the blob");
208
- }
209
- if (response.headers.get("Content-Type")?.startsWith("application/json")) {
210
- return await response.json();
211
- }
212
- return await response.blob();
213
- }
214
-
215
- // src/vendor/fetch-event-source/parse.ts
216
- function getLines(onLine) {
217
- let buffer;
218
- let position;
219
- let fieldLength;
220
- let discardTrailingNewline = false;
221
- return function onChunk(arr) {
222
- if (buffer === void 0) {
223
- buffer = arr;
224
- position = 0;
225
- fieldLength = -1;
226
- } else {
227
- buffer = concat(buffer, arr);
228
- }
229
- const bufLength = buffer.length;
230
- let lineStart = 0;
231
- while (position < bufLength) {
232
- if (discardTrailingNewline) {
233
- if (buffer[position] === 10 /* NewLine */) {
234
- lineStart = ++position;
235
- }
236
- discardTrailingNewline = false;
237
- }
238
- let lineEnd = -1;
239
- for (; position < bufLength && lineEnd === -1; ++position) {
240
- switch (buffer[position]) {
241
- case 58 /* Colon */:
242
- if (fieldLength === -1) {
243
- fieldLength = position - lineStart;
244
- }
245
- break;
246
- case 13 /* CarriageReturn */:
247
- discardTrailingNewline = true;
248
- case 10 /* NewLine */:
249
- lineEnd = position;
250
- break;
251
- }
252
- }
253
- if (lineEnd === -1) {
254
- break;
255
- }
256
- onLine(buffer.subarray(lineStart, lineEnd), fieldLength);
257
- lineStart = position;
258
- fieldLength = -1;
259
- }
260
- if (lineStart === bufLength) {
261
- buffer = void 0;
262
- } else if (lineStart !== 0) {
263
- buffer = buffer.subarray(lineStart);
264
- position -= lineStart;
265
- }
266
- };
267
- }
268
- function getMessages(onId, onRetry, onMessage) {
269
- let message = newMessage();
270
- const decoder = new TextDecoder();
271
- return function onLine(line, fieldLength) {
272
- if (line.length === 0) {
273
- onMessage?.(message);
274
- message = newMessage();
275
- } else if (fieldLength > 0) {
276
- const field = decoder.decode(line.subarray(0, fieldLength));
277
- const valueOffset = fieldLength + (line[fieldLength + 1] === 32 /* Space */ ? 2 : 1);
278
- const value = decoder.decode(line.subarray(valueOffset));
279
- switch (field) {
280
- case "data":
281
- message.data = message.data ? message.data + "\n" + value : value;
282
- break;
283
- case "event":
284
- message.event = value;
285
- break;
286
- case "id":
287
- onId(message.id = value);
288
- break;
289
- case "retry":
290
- const retry = parseInt(value, 10);
291
- if (!isNaN(retry)) {
292
- onRetry(message.retry = retry);
293
- }
294
- break;
295
- }
296
- }
297
- };
298
- }
299
- function concat(a, b) {
300
- const res = new Uint8Array(a.length + b.length);
301
- res.set(a);
302
- res.set(b, a.length);
303
- return res;
304
- }
305
- function newMessage() {
306
- return {
307
- data: "",
308
- event: "",
309
- id: "",
310
- retry: void 0
311
- };
312
- }
313
-
314
- // src/tasks/custom/streamingRequest.ts
315
- async function* streamingRequest(args, options) {
316
- const { url, info } = await makeRequestOptions({ ...args, stream: true }, options);
317
- const response = await (options?.fetch ?? fetch)(url, info);
318
- if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) {
319
- return yield* streamingRequest(args, {
320
- ...options,
321
- wait_for_model: true
322
- });
323
- }
324
- if (!response.ok) {
325
- if (response.headers.get("Content-Type")?.startsWith("application/json")) {
326
- const output = await response.json();
327
- if ([400, 422, 404, 500].includes(response.status) && options?.chatCompletion) {
328
- throw new Error(`Server ${args.model} does not seem to support chat completion. Error: ${output.error}`);
329
- }
330
- if (output.error) {
331
- throw new Error(output.error);
332
- }
333
- }
334
- throw new Error(`Server response contains error: ${response.status}`);
335
- }
336
- if (!response.headers.get("content-type")?.startsWith("text/event-stream")) {
337
- throw new Error(
338
- `Server does not support event stream content type, it returned ` + response.headers.get("content-type")
339
- );
340
- }
341
- if (!response.body) {
342
- return;
343
- }
344
- const reader = response.body.getReader();
345
- let events = [];
346
- const onEvent = (event) => {
347
- events.push(event);
348
- };
349
- const onChunk = getLines(
350
- getMessages(
351
- () => {
352
- },
353
- () => {
354
- },
355
- onEvent
356
- )
357
- );
358
- try {
359
- while (true) {
360
- const { done, value } = await reader.read();
361
- if (done)
362
- return;
363
- onChunk(value);
364
- for (const event of events) {
365
- if (event.data.length > 0) {
366
- if (event.data === "[DONE]") {
367
- return;
368
- }
369
- const data = JSON.parse(event.data);
370
- if (typeof data === "object" && data !== null && "error" in data) {
371
- throw new Error(data.error);
372
- }
373
- yield data;
374
- }
375
- }
376
- events = [];
377
- }
378
- } finally {
379
- reader.releaseLock();
380
- }
381
- }
382
-
383
- // src/lib/InferenceOutputError.ts
384
- var InferenceOutputError = class extends TypeError {
385
- constructor(message) {
386
- super(
387
- `Invalid inference output: ${message}. Use the 'request' method with the same parameters to do a custom call with no type checking.`
388
- );
389
- this.name = "InferenceOutputError";
390
- }
391
- };
392
-
393
- // src/tasks/audio/audioClassification.ts
394
- async function audioClassification(args, options) {
395
- const res = await request(args, {
396
- ...options,
397
- taskHint: "audio-classification"
398
- });
399
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.score === "number");
400
- if (!isValidOutput) {
401
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
402
- }
403
- return res;
404
- }
405
-
406
- // src/tasks/audio/automaticSpeechRecognition.ts
407
- async function automaticSpeechRecognition(args, options) {
408
- const res = await request(args, {
409
- ...options,
410
- taskHint: "automatic-speech-recognition"
411
- });
412
- const isValidOutput = typeof res?.text === "string";
413
- if (!isValidOutput) {
414
- throw new InferenceOutputError("Expected {text: string}");
415
- }
416
- return res;
417
- }
418
-
419
- // src/tasks/audio/textToSpeech.ts
420
- async function textToSpeech(args, options) {
421
- const res = await request(args, {
422
- ...options,
423
- taskHint: "text-to-speech"
424
- });
425
- const isValidOutput = res && res instanceof Blob;
426
- if (!isValidOutput) {
427
- throw new InferenceOutputError("Expected Blob");
428
- }
429
- return res;
430
- }
431
-
432
- // src/tasks/audio/audioToAudio.ts
433
- async function audioToAudio(args, options) {
434
- const res = await request(args, {
435
- ...options,
436
- taskHint: "audio-to-audio"
437
- });
438
- const isValidOutput = Array.isArray(res) && res.every(
439
- (x) => typeof x.label === "string" && typeof x.blob === "string" && typeof x["content-type"] === "string"
440
- );
441
- if (!isValidOutput) {
442
- throw new InferenceOutputError("Expected Array<{label: string, blob: string, content-type: string}>");
443
- }
444
- return res;
445
- }
446
-
447
- // src/tasks/cv/imageClassification.ts
448
- async function imageClassification(args, options) {
449
- const res = await request(args, {
450
- ...options,
451
- taskHint: "image-classification"
452
- });
453
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.score === "number");
454
- if (!isValidOutput) {
455
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
456
- }
457
- return res;
458
- }
459
-
460
- // src/tasks/cv/imageSegmentation.ts
461
- async function imageSegmentation(args, options) {
462
- const res = await request(args, {
463
- ...options,
464
- taskHint: "image-segmentation"
465
- });
466
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.mask === "string" && typeof x.score === "number");
467
- if (!isValidOutput) {
468
- throw new InferenceOutputError("Expected Array<{label: string, mask: string, score: number}>");
469
- }
470
- return res;
471
- }
472
-
473
- // src/tasks/cv/imageToText.ts
474
- async function imageToText(args, options) {
475
- const res = (await request(args, {
476
- ...options,
477
- taskHint: "image-to-text"
478
- }))?.[0];
479
- if (typeof res?.generated_text !== "string") {
480
- throw new InferenceOutputError("Expected {generated_text: string}");
481
- }
482
- return res;
483
- }
484
-
485
- // src/tasks/cv/objectDetection.ts
486
- async function objectDetection(args, options) {
487
- const res = await request(args, {
488
- ...options,
489
- taskHint: "object-detection"
490
- });
491
- const isValidOutput = Array.isArray(res) && res.every(
492
- (x) => typeof x.label === "string" && typeof x.score === "number" && typeof x.box.xmin === "number" && typeof x.box.ymin === "number" && typeof x.box.xmax === "number" && typeof x.box.ymax === "number"
493
- );
494
- if (!isValidOutput) {
495
- throw new InferenceOutputError(
496
- "Expected Array<{label:string; score:number; box:{xmin:number; ymin:number; xmax:number; ymax:number}}>"
497
- );
498
- }
499
- return res;
500
- }
501
-
502
- // src/tasks/cv/textToImage.ts
503
- async function textToImage(args, options) {
504
- const res = await request(args, {
505
- ...options,
506
- taskHint: "text-to-image"
507
- });
508
- const isValidOutput = res && res instanceof Blob;
509
- if (!isValidOutput) {
510
- throw new InferenceOutputError("Expected Blob");
511
- }
512
- return res;
513
- }
514
-
515
- // src/utils/base64FromBytes.ts
516
- function base64FromBytes(arr) {
517
- if (globalThis.Buffer) {
518
- return globalThis.Buffer.from(arr).toString("base64");
519
- } else {
520
- const bin = [];
521
- arr.forEach((byte) => {
522
- bin.push(String.fromCharCode(byte));
523
- });
524
- return globalThis.btoa(bin.join(""));
525
- }
526
- }
527
-
528
- // src/tasks/cv/imageToImage.ts
529
- async function imageToImage(args, options) {
530
- let reqArgs;
531
- if (!args.parameters) {
532
- reqArgs = {
533
- accessToken: args.accessToken,
534
- model: args.model,
535
- data: args.inputs
536
- };
537
- } else {
538
- reqArgs = {
539
- ...args,
540
- inputs: base64FromBytes(
541
- new Uint8Array(args.inputs instanceof ArrayBuffer ? args.inputs : await args.inputs.arrayBuffer())
542
- )
543
- };
544
- }
545
- const res = await request(reqArgs, {
546
- ...options,
547
- taskHint: "image-to-image"
548
- });
549
- const isValidOutput = res && res instanceof Blob;
550
- if (!isValidOutput) {
551
- throw new InferenceOutputError("Expected Blob");
552
- }
553
- return res;
554
- }
555
-
556
- // src/tasks/cv/zeroShotImageClassification.ts
557
- async function zeroShotImageClassification(args, options) {
558
- const reqArgs = {
559
- ...args,
560
- inputs: {
561
- image: base64FromBytes(
562
- new Uint8Array(
563
- args.inputs.image instanceof ArrayBuffer ? args.inputs.image : await args.inputs.image.arrayBuffer()
564
- )
565
- )
566
- }
567
- };
568
- const res = await request(reqArgs, {
569
- ...options,
570
- taskHint: "zero-shot-image-classification"
571
- });
572
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x.label === "string" && typeof x.score === "number");
573
- if (!isValidOutput) {
574
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
575
- }
576
- return res;
577
- }
578
-
579
- // src/tasks/nlp/featureExtraction.ts
580
- async function featureExtraction(args, options) {
581
- const defaultTask = args.model ? await getDefaultTask(args.model, args.accessToken, options) : void 0;
582
- const res = await request(args, {
583
- ...options,
584
- taskHint: "feature-extraction",
585
- ...defaultTask === "sentence-similarity" && { forceTask: "feature-extraction" }
586
- });
587
- let isValidOutput = true;
588
- const isNumArrayRec = (arr, maxDepth, curDepth = 0) => {
589
- if (curDepth > maxDepth)
590
- return false;
591
- if (arr.every((x) => Array.isArray(x))) {
592
- return arr.every((x) => isNumArrayRec(x, maxDepth, curDepth + 1));
593
- } else {
594
- return arr.every((x) => typeof x === "number");
595
- }
596
- };
597
- isValidOutput = Array.isArray(res) && isNumArrayRec(res, 3, 0);
598
- if (!isValidOutput) {
599
- throw new InferenceOutputError("Expected Array<number[][][] | number[][] | number[] | number>");
600
- }
601
- return res;
602
- }
603
-
604
- // src/tasks/nlp/fillMask.ts
605
- async function fillMask(args, options) {
606
- const res = await request(args, {
607
- ...options,
608
- taskHint: "fill-mask"
609
- });
610
- const isValidOutput = Array.isArray(res) && res.every(
611
- (x) => typeof x.score === "number" && typeof x.sequence === "string" && typeof x.token === "number" && typeof x.token_str === "string"
612
- );
613
- if (!isValidOutput) {
614
- throw new InferenceOutputError(
615
- "Expected Array<{score: number, sequence: string, token: number, token_str: string}>"
616
- );
617
- }
618
- return res;
619
- }
620
-
621
- // src/tasks/nlp/questionAnswering.ts
622
- async function questionAnswering(args, options) {
623
- const res = await request(args, {
624
- ...options,
625
- taskHint: "question-answering"
626
- });
627
- const isValidOutput = typeof res === "object" && !!res && typeof res.answer === "string" && typeof res.end === "number" && typeof res.score === "number" && typeof res.start === "number";
628
- if (!isValidOutput) {
629
- throw new InferenceOutputError("Expected {answer: string, end: number, score: number, start: number}");
630
- }
631
- return res;
632
- }
633
-
634
- // src/tasks/nlp/sentenceSimilarity.ts
635
- async function sentenceSimilarity(args, options) {
636
- const defaultTask = args.model ? await getDefaultTask(args.model, args.accessToken, options) : void 0;
637
- const res = await request(args, {
638
- ...options,
639
- taskHint: "sentence-similarity",
640
- ...defaultTask === "feature-extraction" && { forceTask: "sentence-similarity" }
641
- });
642
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x === "number");
643
- if (!isValidOutput) {
644
- throw new InferenceOutputError("Expected number[]");
645
- }
646
- return res;
647
- }
648
-
649
- // src/tasks/nlp/summarization.ts
650
- async function summarization(args, options) {
651
- const res = await request(args, {
652
- ...options,
653
- taskHint: "summarization"
654
- });
655
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.summary_text === "string");
656
- if (!isValidOutput) {
657
- throw new InferenceOutputError("Expected Array<{summary_text: string}>");
658
- }
659
- return res?.[0];
660
- }
661
-
662
- // src/tasks/nlp/tableQuestionAnswering.ts
663
- async function tableQuestionAnswering(args, options) {
664
- const res = await request(args, {
665
- ...options,
666
- taskHint: "table-question-answering"
667
- });
668
- const isValidOutput = typeof res?.aggregator === "string" && typeof res.answer === "string" && Array.isArray(res.cells) && res.cells.every((x) => typeof x === "string") && Array.isArray(res.coordinates) && res.coordinates.every((coord) => Array.isArray(coord) && coord.every((x) => typeof x === "number"));
669
- if (!isValidOutput) {
670
- throw new InferenceOutputError(
671
- "Expected {aggregator: string, answer: string, cells: string[], coordinates: number[][]}"
672
- );
673
- }
674
- return res;
675
- }
676
-
677
- // src/tasks/nlp/textClassification.ts
678
- async function textClassification(args, options) {
679
- const res = (await request(args, {
680
- ...options,
681
- taskHint: "text-classification"
682
- }))?.[0];
683
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.label === "string" && typeof x.score === "number");
684
- if (!isValidOutput) {
685
- throw new InferenceOutputError("Expected Array<{label: string, score: number}>");
686
- }
687
- return res;
688
- }
689
-
690
- // src/utils/toArray.ts
691
- function toArray(obj) {
692
- if (Array.isArray(obj)) {
693
- return obj;
694
- }
695
- return [obj];
696
- }
697
-
698
- // src/tasks/nlp/textGeneration.ts
699
- async function textGeneration(args, options) {
700
- const res = toArray(
701
- await request(args, {
702
- ...options,
703
- taskHint: "text-generation"
704
- })
705
- );
706
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.generated_text === "string");
707
- if (!isValidOutput) {
708
- throw new InferenceOutputError("Expected Array<{generated_text: string}>");
709
- }
710
- return res?.[0];
711
- }
712
-
713
- // src/tasks/nlp/textGenerationStream.ts
714
- async function* textGenerationStream(args, options) {
715
- yield* streamingRequest(args, {
716
- ...options,
717
- taskHint: "text-generation"
718
- });
719
- }
720
-
721
- // src/tasks/nlp/tokenClassification.ts
722
- async function tokenClassification(args, options) {
723
- const res = toArray(
724
- await request(args, {
725
- ...options,
726
- taskHint: "token-classification"
727
- })
728
- );
729
- const isValidOutput = Array.isArray(res) && res.every(
730
- (x) => typeof x.end === "number" && typeof x.entity_group === "string" && typeof x.score === "number" && typeof x.start === "number" && typeof x.word === "string"
731
- );
732
- if (!isValidOutput) {
733
- throw new InferenceOutputError(
734
- "Expected Array<{end: number, entity_group: string, score: number, start: number, word: string}>"
735
- );
736
- }
737
- return res;
738
- }
739
-
740
- // src/tasks/nlp/translation.ts
741
- async function translation(args, options) {
742
- const res = await request(args, {
743
- ...options,
744
- taskHint: "translation"
745
- });
746
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.translation_text === "string");
747
- if (!isValidOutput) {
748
- throw new InferenceOutputError("Expected type Array<{translation_text: string}>");
749
- }
750
- return res?.length === 1 ? res?.[0] : res;
751
- }
752
-
753
- // src/tasks/nlp/zeroShotClassification.ts
754
- async function zeroShotClassification(args, options) {
755
- const res = toArray(
756
- await request(args, {
757
- ...options,
758
- taskHint: "zero-shot-classification"
759
- })
760
- );
761
- const isValidOutput = Array.isArray(res) && res.every(
762
- (x) => Array.isArray(x.labels) && x.labels.every((_label) => typeof _label === "string") && Array.isArray(x.scores) && x.scores.every((_score) => typeof _score === "number") && typeof x.sequence === "string"
763
- );
764
- if (!isValidOutput) {
765
- throw new InferenceOutputError("Expected Array<{labels: string[], scores: number[], sequence: string}>");
766
- }
767
- return res;
768
- }
769
-
770
- // src/tasks/nlp/chatCompletion.ts
771
- async function chatCompletion(args, options) {
772
- const res = await request(args, {
773
- ...options,
774
- taskHint: "text-generation",
775
- chatCompletion: true
776
- });
777
- const isValidOutput = typeof res === "object" && Array.isArray(res?.choices) && typeof res?.created === "number" && typeof res?.id === "string" && typeof res?.model === "string" && typeof res?.system_fingerprint === "string" && typeof res?.usage === "object";
778
- if (!isValidOutput) {
779
- throw new InferenceOutputError("Expected ChatCompletionOutput");
780
- }
781
- return res;
782
- }
783
-
784
- // src/tasks/nlp/chatCompletionStream.ts
785
- async function* chatCompletionStream(args, options) {
786
- yield* streamingRequest(args, {
787
- ...options,
788
- taskHint: "text-generation",
789
- chatCompletion: true
790
- });
791
- }
792
-
793
- // src/tasks/multimodal/documentQuestionAnswering.ts
794
- async function documentQuestionAnswering(args, options) {
795
- const reqArgs = {
796
- ...args,
797
- inputs: {
798
- question: args.inputs.question,
799
- // convert Blob or ArrayBuffer to base64
800
- image: base64FromBytes(
801
- new Uint8Array(
802
- args.inputs.image instanceof ArrayBuffer ? args.inputs.image : await args.inputs.image.arrayBuffer()
803
- )
804
- )
805
- }
806
- };
807
- const res = toArray(
808
- await request(reqArgs, {
809
- ...options,
810
- taskHint: "document-question-answering"
811
- })
812
- )?.[0];
813
- const isValidOutput = typeof res?.answer === "string" && (typeof res.end === "number" || typeof res.end === "undefined") && (typeof res.score === "number" || typeof res.score === "undefined") && (typeof res.start === "number" || typeof res.start === "undefined");
814
- if (!isValidOutput) {
815
- throw new InferenceOutputError("Expected Array<{answer: string, end?: number, score?: number, start?: number}>");
816
- }
817
- return res;
818
- }
819
-
820
- // src/tasks/multimodal/visualQuestionAnswering.ts
821
- async function visualQuestionAnswering(args, options) {
822
- const reqArgs = {
823
- ...args,
824
- inputs: {
825
- question: args.inputs.question,
826
- // convert Blob or ArrayBuffer to base64
827
- image: base64FromBytes(
828
- new Uint8Array(
829
- args.inputs.image instanceof ArrayBuffer ? args.inputs.image : await args.inputs.image.arrayBuffer()
830
- )
831
- )
832
- }
833
- };
834
- const res = (await request(reqArgs, {
835
- ...options,
836
- taskHint: "visual-question-answering"
837
- }))?.[0];
838
- const isValidOutput = typeof res?.answer === "string" && typeof res.score === "number";
839
- if (!isValidOutput) {
840
- throw new InferenceOutputError("Expected Array<{answer: string, score: number}>");
841
- }
842
- return res;
843
- }
844
-
845
- // src/tasks/tabular/tabularRegression.ts
846
- async function tabularRegression(args, options) {
847
- const res = await request(args, {
848
- ...options,
849
- taskHint: "tabular-regression"
850
- });
851
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x === "number");
852
- if (!isValidOutput) {
853
- throw new InferenceOutputError("Expected number[]");
854
- }
855
- return res;
856
- }
857
-
858
- // src/tasks/tabular/tabularClassification.ts
859
- async function tabularClassification(args, options) {
860
- const res = await request(args, {
861
- ...options,
862
- taskHint: "tabular-classification"
863
- });
864
- const isValidOutput = Array.isArray(res) && res.every((x) => typeof x === "number");
865
- if (!isValidOutput) {
866
- throw new InferenceOutputError("Expected number[]");
867
- }
868
- return res;
869
- }
870
-
871
- // src/HfInference.ts
872
- var HfInference = class {
873
- accessToken;
874
- defaultOptions;
875
- constructor(accessToken = "", defaultOptions = {}) {
876
- this.accessToken = accessToken;
877
- this.defaultOptions = defaultOptions;
878
- for (const [name, fn] of Object.entries(tasks_exports)) {
879
- Object.defineProperty(this, name, {
880
- enumerable: false,
881
- value: (params, options) => (
882
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
883
- fn({ ...params, accessToken }, { ...defaultOptions, ...options })
884
- )
885
- });
886
- }
887
- }
888
- /**
889
- * Returns copy of HfInference tied to a specified endpoint.
890
- */
891
- endpoint(endpointUrl) {
892
- return new HfInferenceEndpoint(endpointUrl, this.accessToken, this.defaultOptions);
893
- }
894
- };
895
- var HfInferenceEndpoint = class {
896
- constructor(endpointUrl, accessToken = "", defaultOptions = {}) {
897
- accessToken;
898
- defaultOptions;
899
- for (const [name, fn] of Object.entries(tasks_exports)) {
900
- Object.defineProperty(this, name, {
901
- enumerable: false,
902
- value: (params, options) => (
903
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
904
- fn({ ...params, accessToken, endpointUrl }, { ...defaultOptions, ...options })
905
- )
906
- });
907
- }
908
- }
909
- };
910
- export {
911
- HfInference,
912
- HfInferenceEndpoint,
913
- InferenceOutputError,
914
- audioClassification,
915
- audioToAudio,
916
- automaticSpeechRecognition,
917
- chatCompletion,
918
- chatCompletionStream,
919
- documentQuestionAnswering,
920
- featureExtraction,
921
- fillMask,
922
- imageClassification,
923
- imageSegmentation,
924
- imageToImage,
925
- imageToText,
926
- objectDetection,
927
- questionAnswering,
928
- request,
929
- sentenceSimilarity,
930
- streamingRequest,
931
- summarization,
932
- tableQuestionAnswering,
933
- tabularClassification,
934
- tabularRegression,
935
- textClassification,
936
- textGeneration,
937
- textGenerationStream,
938
- textToImage,
939
- textToSpeech,
940
- tokenClassification,
941
- translation,
942
- visualQuestionAnswering,
943
- zeroShotClassification,
944
- zeroShotImageClassification
945
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/HfInference.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import * as tasks from "./tasks";
2
- import type { Options } from "./types";
3
- import type { DistributiveOmit } from "./utils/distributive-omit";
4
- type Task = typeof tasks;
5
- type TaskWithNoAccessToken = {
6
- [key in keyof Task]: (args: DistributiveOmit<Parameters<Task[key]>[0], "accessToken">, options?: Parameters<Task[key]>[1]) => ReturnType<Task[key]>;
7
- };
8
- type TaskWithNoAccessTokenNoEndpointUrl = {
9
- [key in keyof Task]: (args: DistributiveOmit<Parameters<Task[key]>[0], "accessToken" | "endpointUrl">, options?: Parameters<Task[key]>[1]) => ReturnType<Task[key]>;
10
- };
11
- export declare class HfInference {
12
- private readonly accessToken;
13
- private readonly defaultOptions;
14
- constructor(accessToken?: string, defaultOptions?: Options);
15
- /**
16
- * Returns copy of HfInference tied to a specified endpoint.
17
- */
18
- endpoint(endpointUrl: string): HfInferenceEndpoint;
19
- }
20
- export declare class HfInferenceEndpoint {
21
- constructor(endpointUrl: string, accessToken?: string, defaultOptions?: Options);
22
- }
23
- export interface HfInference extends TaskWithNoAccessToken {
24
- }
25
- export interface HfInferenceEndpoint extends TaskWithNoAccessTokenNoEndpointUrl {
26
- }
27
- export {};
28
- //# sourceMappingURL=HfInference.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/HfInference.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"HfInference.d.ts","sourceRoot":"","sources":["../../src/HfInference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAKlE,KAAK,IAAI,GAAG,OAAO,KAAK,CAAC;AAEzB,KAAK,qBAAqB,GAAG;KAC3B,GAAG,IAAI,MAAM,IAAI,GAAG,CACpB,IAAI,EAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,EAC/D,OAAO,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAC9B,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;CAC1B,CAAC;AAEF,KAAK,kCAAkC,GAAG;KACxC,GAAG,IAAI,MAAM,IAAI,GAAG,CACpB,IAAI,EAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAAC,EAC/E,OAAO,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAC9B,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;CAC1B,CAAC;AAEF,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;gBAE7B,WAAW,SAAK,EAAE,cAAc,GAAE,OAAY;IAc1D;;OAEG;IACI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,mBAAmB;CAGzD;AAED,qBAAa,mBAAmB;gBACnB,WAAW,EAAE,MAAM,EAAE,WAAW,SAAK,EAAE,cAAc,GAAE,OAAY;CAa/E;AAED,MAAM,WAAW,WAAY,SAAQ,qBAAqB;CAAG;AAE7D,MAAM,WAAW,mBAAoB,SAAQ,kCAAkC;CAAG"}
 
 
data/node_modules/@huggingface/inference/dist/src/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { HfInference, HfInferenceEndpoint } from "./HfInference";
2
- export { InferenceOutputError } from "./lib/InferenceOutputError";
3
- export * from "./types";
4
- export * from "./tasks";
5
- //# sourceMappingURL=index.d.ts.map
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
 
 
data/node_modules/@huggingface/inference/dist/src/lib/InferenceOutputError.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare class InferenceOutputError extends TypeError {
2
- constructor(message: string);
3
- }
4
- //# sourceMappingURL=InferenceOutputError.d.ts.map
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/lib/InferenceOutputError.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"InferenceOutputError.d.ts","sourceRoot":"","sources":["../../../src/lib/InferenceOutputError.ts"],"names":[],"mappings":"AAAA,qBAAa,oBAAqB,SAAQ,SAAS;gBACtC,OAAO,EAAE,MAAM;CAM3B"}
 
 
data/node_modules/@huggingface/inference/dist/src/lib/getDefaultTask.d.ts DELETED
@@ -1,12 +0,0 @@
1
- export declare const HF_HUB_URL = "https://huggingface.co";
2
- export interface DefaultTaskOptions {
3
- fetch?: typeof fetch;
4
- }
5
- /**
6
- * Get the default task. Use a LRU cache of 1000 items with 10 minutes expiration
7
- * to avoid making too many calls to the HF hub.
8
- *
9
- * @returns The default task for the model, or `null` if it was impossible to get it
10
- */
11
- export declare function getDefaultTask(model: string, accessToken: string | undefined, options?: DefaultTaskOptions): Promise<string | null>;
12
- //# sourceMappingURL=getDefaultTask.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/lib/getDefaultTask.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDefaultTask.d.ts","sourceRoot":"","sources":["../../../src/lib/getDefaultTask.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,UAAU,2BAA2B,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IAClC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CACnC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkCxB"}
 
 
data/node_modules/@huggingface/inference/dist/src/lib/isUrl.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function isUrl(modelOrUrl: string): boolean;
2
- //# sourceMappingURL=isUrl.d.ts.map
 
 
 
data/node_modules/@huggingface/inference/dist/src/lib/isUrl.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"isUrl.d.ts","sourceRoot":"","sources":["../../../src/lib/isUrl.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEjD"}
 
 
data/node_modules/@huggingface/inference/dist/src/lib/makeRequestOptions.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import type { InferenceTask, Options, RequestArgs } from "../types";
2
- /**
3
- * Helper that prepares request arguments
4
- */
5
- export declare function makeRequestOptions(args: RequestArgs & {
6
- data?: Blob | ArrayBuffer;
7
- stream?: boolean;
8
- }, options?: Options & {
9
- /** When a model can be used for multiple tasks, and we want to run a non-default task */
10
- forceTask?: string | InferenceTask;
11
- /** To load default model if needed */
12
- taskHint?: InferenceTask;
13
- chatCompletion?: boolean;
14
- }): Promise<{
15
- url: string;
16
- info: RequestInit;
17
- }>;
18
- //# sourceMappingURL=makeRequestOptions.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/lib/makeRequestOptions.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"makeRequestOptions.d.ts","sourceRoot":"","sources":["../../../src/lib/makeRequestOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAYpE;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,WAAW,GAAG;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,EACD,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACnC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,CAkG7C"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioClassification.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type AudioClassificationArgs = BaseArgs & {
3
- /**
4
- * Binary audio data
5
- */
6
- data: Blob | ArrayBuffer;
7
- };
8
- export interface AudioClassificationOutputValue {
9
- /**
10
- * The label for the class (model specific)
11
- */
12
- label: string;
13
- /**
14
- * A float that represents how likely it is that the audio file belongs to this class.
15
- */
16
- score: number;
17
- }
18
- export type AudioClassificationReturn = AudioClassificationOutputValue[];
19
- /**
20
- * This task reads some audio input and outputs the likelihood of classes.
21
- * Recommended model: superb/hubert-large-superb-er
22
- */
23
- export declare function audioClassification(args: AudioClassificationArgs, options?: Options): Promise<AudioClassificationReturn>;
24
- //# sourceMappingURL=audioClassification.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioClassification.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioClassification.d.ts","sourceRoot":"","sources":["../../../../src/tasks/audio/audioClassification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG;IAChD;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC9C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,yBAAyB,GAAG,8BAA8B,EAAE,CAAC;AAEzE;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,yBAAyB,CAAC,CAWpC"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioToAudio.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type AudioToAudioArgs = BaseArgs & {
3
- /**
4
- * Binary audio data
5
- */
6
- data: Blob | ArrayBuffer;
7
- };
8
- export interface AudioToAudioOutputValue {
9
- /**
10
- * The label for the audio output (model specific)
11
- */
12
- label: string;
13
- /**
14
- * Base64 encoded audio output.
15
- */
16
- blob: string;
17
- /**
18
- * Content-type for blob, e.g. audio/flac
19
- */
20
- "content-type": string;
21
- }
22
- export type AudioToAudioReturn = AudioToAudioOutputValue[];
23
- /**
24
- * This task reads some audio input and outputs one or multiple audio files.
25
- * Example model: speechbrain/sepformer-wham does audio source separation.
26
- */
27
- export declare function audioToAudio(args: AudioToAudioArgs, options?: Options): Promise<AudioToAudioReturn>;
28
- //# sourceMappingURL=audioToAudio.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/audioToAudio.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioToAudio.d.ts","sourceRoot":"","sources":["../../../../src/tasks/audio/audioToAudio.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACzC;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACvC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,EAAE,CAAC;AAE3D;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAczG"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/automaticSpeechRecognition.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type AutomaticSpeechRecognitionArgs = BaseArgs & {
3
- /**
4
- * Binary audio data
5
- */
6
- data: Blob | ArrayBuffer;
7
- };
8
- export interface AutomaticSpeechRecognitionOutput {
9
- /**
10
- * The text that was recognized from the audio
11
- */
12
- text: string;
13
- }
14
- /**
15
- * This task reads some audio input and outputs the said words within the audio files.
16
- * Recommended model (english language): facebook/wav2vec2-large-960h-lv60-self
17
- */
18
- export declare function automaticSpeechRecognition(args: AutomaticSpeechRecognitionArgs, options?: Options): Promise<AutomaticSpeechRecognitionOutput>;
19
- //# sourceMappingURL=automaticSpeechRecognition.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/automaticSpeechRecognition.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"automaticSpeechRecognition.d.ts","sourceRoot":"","sources":["../../../../src/tasks/audio/automaticSpeechRecognition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,8BAA8B,GAAG,QAAQ,GAAG;IACvD;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC/C,IAAI,EAAE,8BAA8B,EACpC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,gCAAgC,CAAC,CAU3C"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/textToSpeech.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type TextToSpeechArgs = BaseArgs & {
3
- /**
4
- * The text to generate an audio from
5
- */
6
- inputs: string;
7
- };
8
- export type TextToSpeechOutput = Blob;
9
- /**
10
- * This task synthesize an audio of a voice pronouncing a given text.
11
- * Recommended model: espnet/kan-bayashi_ljspeech_vits
12
- */
13
- export declare function textToSpeech(args: TextToSpeechArgs, options?: Options): Promise<TextToSpeechOutput>;
14
- //# sourceMappingURL=textToSpeech.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/audio/textToSpeech.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"textToSpeech.d.ts","sourceRoot":"","sources":["../../../../src/tasks/audio/textToSpeech.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACzC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEtC;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAUzG"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/custom/request.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { InferenceTask, Options, RequestArgs } from "../../types";
2
- /**
3
- * Primitive to make custom calls to Inference Endpoints
4
- */
5
- export declare function request<T>(args: RequestArgs, options?: Options & {
6
- /** When a model can be used for multiple tasks, and we want to run a non-default task */
7
- task?: string | InferenceTask;
8
- /** To load default model if needed */
9
- taskHint?: InferenceTask;
10
- /** Is chat completion compatible */
11
- chatCompletion?: boolean;
12
- }): Promise<T>;
13
- //# sourceMappingURL=request.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/custom/request.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGvE;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC9B,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,OAAO,CAAC,CAAC,CAAC,CA6BZ"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/custom/streamingRequest.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { InferenceTask, Options, RequestArgs } from "../../types";
2
- /**
3
- * Primitive to make custom inference calls that expect server-sent events, and returns the response through a generator
4
- */
5
- export declare function streamingRequest<T>(args: RequestArgs, options?: Options & {
6
- /** When a model can be used for multiple tasks, and we want to run a non-default task */
7
- task?: string | InferenceTask;
8
- /** To load default model if needed */
9
- taskHint?: InferenceTask;
10
- /** Is chat completion compatible */
11
- chatCompletion?: boolean;
12
- }): AsyncGenerator<T>;
13
- //# sourceMappingURL=streamingRequest.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/custom/streamingRequest.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"streamingRequest.d.ts","sourceRoot":"","sources":["../../../../src/tasks/custom/streamingRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAKvE;;GAEG;AACH,wBAAuB,gBAAgB,CAAC,CAAC,EACxC,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE,OAAO,GAAG;IACnB,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,oCAAoC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB,GACC,cAAc,CAAC,CAAC,CAAC,CAuEnB"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageClassification.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type ImageClassificationArgs = BaseArgs & {
3
- /**
4
- * Binary image data
5
- */
6
- data: Blob | ArrayBuffer;
7
- };
8
- export interface ImageClassificationOutputValue {
9
- /**
10
- * The label for the class (model specific)
11
- */
12
- label: string;
13
- /**
14
- * A float that represents how likely it is that the image file belongs to this class.
15
- */
16
- score: number;
17
- }
18
- export type ImageClassificationOutput = ImageClassificationOutputValue[];
19
- /**
20
- * This task reads some image input and outputs the likelihood of classes.
21
- * Recommended model: google/vit-base-patch16-224
22
- */
23
- export declare function imageClassification(args: ImageClassificationArgs, options?: Options): Promise<ImageClassificationOutput>;
24
- //# sourceMappingURL=imageClassification.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageClassification.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"imageClassification.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageClassification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG;IAChD;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC9C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,yBAAyB,GAAG,8BAA8B,EAAE,CAAC;AAEzE;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,yBAAyB,CAAC,CAWpC"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageSegmentation.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type ImageSegmentationArgs = BaseArgs & {
3
- /**
4
- * Binary image data
5
- */
6
- data: Blob | ArrayBuffer;
7
- };
8
- export interface ImageSegmentationOutputValue {
9
- /**
10
- * The label for the class (model specific) of a segment.
11
- */
12
- label: string;
13
- /**
14
- * A str (base64 str of a single channel black-and-white img) representing the mask of a segment.
15
- */
16
- mask: string;
17
- /**
18
- * A float that represents how likely it is that the detected object belongs to the given class.
19
- */
20
- score: number;
21
- }
22
- export type ImageSegmentationOutput = ImageSegmentationOutputValue[];
23
- /**
24
- * This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
25
- * Recommended model: facebook/detr-resnet-50-panoptic
26
- */
27
- export declare function imageSegmentation(args: ImageSegmentationArgs, options?: Options): Promise<ImageSegmentationOutput>;
28
- //# sourceMappingURL=imageSegmentation.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageSegmentation.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"imageSegmentation.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageSegmentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG;IAC9C;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,EAAE,CAAC;AAErE;;;GAGG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,uBAAuB,CAAC,CAYlC"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToImage.d.ts DELETED
@@ -1,55 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type ImageToImageArgs = BaseArgs & {
3
- /**
4
- * The initial image condition
5
- *
6
- **/
7
- inputs: Blob | ArrayBuffer;
8
- parameters?: {
9
- /**
10
- * The text prompt to guide the image generation.
11
- */
12
- prompt?: string;
13
- /**
14
- * strengh param only works for SD img2img and alt diffusion img2img models
15
- * Conceptually, indicates how much to transform the reference `image`. Must be between 0 and 1. `image`
16
- * will be used as a starting point, adding more noise to it the larger the `strength`. The number of
17
- * denoising steps depends on the amount of noise initially added. When `strength` is 1, added noise will
18
- * be maximum and the denoising process will run for the full number of iterations specified in
19
- * `num_inference_steps`. A value of 1, therefore, essentially ignores `image`.
20
- **/
21
- strength?: number;
22
- /**
23
- * An optional negative prompt for the image generation
24
- */
25
- negative_prompt?: string;
26
- /**
27
- * The height in pixels of the generated image
28
- */
29
- height?: number;
30
- /**
31
- * The width in pixels of the generated image
32
- */
33
- width?: number;
34
- /**
35
- * The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference.
36
- */
37
- num_inference_steps?: number;
38
- /**
39
- * Guidance scale: Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, usually at the expense of lower image quality.
40
- */
41
- guidance_scale?: number;
42
- /**
43
- * guess_mode only works for ControlNet models, defaults to False In this mode, the ControlNet encoder will try best to recognize the content of the input image even if
44
- * you remove all prompts. The `guidance_scale` between 3.0 and 5.0 is recommended.
45
- */
46
- guess_mode?: boolean;
47
- };
48
- };
49
- export type ImageToImageOutput = Blob;
50
- /**
51
- * This task reads some text input and outputs an image.
52
- * Recommended model: lllyasviel/sd-controlnet-depth
53
- */
54
- export declare function imageToImage(args: ImageToImageArgs, options?: Options): Promise<ImageToImageOutput>;
55
- //# sourceMappingURL=imageToImage.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToImage.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"imageToImage.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageToImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAIlE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACzC;;;QAGI;IACJ,MAAM,EAAE,IAAI,GAAG,WAAW,CAAC;IAE3B,UAAU,CAAC,EAAE;QACZ;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;;;;;YAOI;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEtC;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAyBzG"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToText.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type ImageToTextArgs = BaseArgs & {
3
- /**
4
- * Binary image data
5
- */
6
- data: Blob | ArrayBuffer;
7
- };
8
- export interface ImageToTextOutput {
9
- /**
10
- * The generated caption
11
- */
12
- generated_text: string;
13
- }
14
- /**
15
- * This task reads some image input and outputs the text caption.
16
- */
17
- export declare function imageToText(args: ImageToTextArgs, options?: Options): Promise<ImageToTextOutput>;
18
- //# sourceMappingURL=imageToText.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/imageToText.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"imageToText.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/imageToText.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG;IACxC;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAatG"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/objectDetection.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type ObjectDetectionArgs = BaseArgs & {
3
- /**
4
- * Binary image data
5
- */
6
- data: Blob | ArrayBuffer;
7
- };
8
- export interface ObjectDetectionOutputValue {
9
- /**
10
- * A dict (with keys [xmin,ymin,xmax,ymax]) representing the bounding box of a detected object.
11
- */
12
- box: {
13
- xmax: number;
14
- xmin: number;
15
- ymax: number;
16
- ymin: number;
17
- };
18
- /**
19
- * The label for the class (model specific) of a detected object.
20
- */
21
- label: string;
22
- /**
23
- * A float that represents how likely it is that the detected object belongs to the given class.
24
- */
25
- score: number;
26
- }
27
- export type ObjectDetectionOutput = ObjectDetectionOutputValue[];
28
- /**
29
- * This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects.
30
- * Recommended model: facebook/detr-resnet-50
31
- */
32
- export declare function objectDetection(args: ObjectDetectionArgs, options?: Options): Promise<ObjectDetectionOutput>;
33
- //# sourceMappingURL=objectDetection.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/objectDetection.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"objectDetection.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/objectDetection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG;IAC5C;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,qBAAqB,GAAG,0BAA0B,EAAE,CAAC;AAEjE;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAsBlH"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/textToImage.d.ts DELETED
@@ -1,36 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type TextToImageArgs = BaseArgs & {
3
- /**
4
- * The text to generate an image from
5
- */
6
- inputs: string;
7
- parameters?: {
8
- /**
9
- * An optional negative prompt for the image generation
10
- */
11
- negative_prompt?: string;
12
- /**
13
- * The height in pixels of the generated image
14
- */
15
- height?: number;
16
- /**
17
- * The width in pixels of the generated image
18
- */
19
- width?: number;
20
- /**
21
- * The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference.
22
- */
23
- num_inference_steps?: number;
24
- /**
25
- * Guidance scale: Higher guidance scale encourages to generate images that are closely linked to the text `prompt`, usually at the expense of lower image quality.
26
- */
27
- guidance_scale?: number;
28
- };
29
- };
30
- export type TextToImageOutput = Blob;
31
- /**
32
- * This task reads some text input and outputs an image.
33
- * Recommended model: stabilityai/stable-diffusion-2
34
- */
35
- export declare function textToImage(args: TextToImageArgs, options?: Options): Promise<TextToImageOutput>;
36
- //# sourceMappingURL=textToImage.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/textToImage.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"textToImage.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/textToImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGrD,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG;IACxC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,CAAC,EAAE;QACZ;;WAEG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf;;WAEG;QACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAErC;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAUtG"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/zeroShotImageClassification.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type ZeroShotImageClassificationArgs = BaseArgs & {
3
- inputs: {
4
- /**
5
- * Binary image data
6
- */
7
- image: Blob | ArrayBuffer;
8
- };
9
- parameters: {
10
- /**
11
- * A list of strings that are potential classes for inputs. (max 10)
12
- */
13
- candidate_labels: string[];
14
- };
15
- };
16
- export interface ZeroShotImageClassificationOutputValue {
17
- label: string;
18
- score: number;
19
- }
20
- export type ZeroShotImageClassificationOutput = ZeroShotImageClassificationOutputValue[];
21
- /**
22
- * Classify an image to specified classes.
23
- * Recommended model: openai/clip-vit-large-patch14-336
24
- */
25
- export declare function zeroShotImageClassification(args: ZeroShotImageClassificationArgs, options?: Options): Promise<ZeroShotImageClassificationOutput>;
26
- //# sourceMappingURL=zeroShotImageClassification.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/cv/zeroShotImageClassification.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"zeroShotImageClassification.d.ts","sourceRoot":"","sources":["../../../../src/tasks/cv/zeroShotImageClassification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKrD,MAAM,MAAM,+BAA+B,GAAG,QAAQ,GAAG;IACxD,MAAM,EAAE;QACP;;WAEG;QACH,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC;KAC1B,CAAC;IACF,UAAU,EAAE;QACX;;WAEG;QACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC;CACF,CAAC;AAEF,MAAM,WAAW,sCAAsC;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,iCAAiC,GAAG,sCAAsC,EAAE,CAAC;AAEzF;;;GAGG;AACH,wBAAsB,2BAA2B,CAChD,IAAI,EAAE,+BAA+B,EACrC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,iCAAiC,CAAC,CAsB5C"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/index.d.ts DELETED
@@ -1,32 +0,0 @@
1
- export * from "./custom/request";
2
- export * from "./custom/streamingRequest";
3
- export * from "./audio/audioClassification";
4
- export * from "./audio/automaticSpeechRecognition";
5
- export * from "./audio/textToSpeech";
6
- export * from "./audio/audioToAudio";
7
- export * from "./cv/imageClassification";
8
- export * from "./cv/imageSegmentation";
9
- export * from "./cv/imageToText";
10
- export * from "./cv/objectDetection";
11
- export * from "./cv/textToImage";
12
- export * from "./cv/imageToImage";
13
- export * from "./cv/zeroShotImageClassification";
14
- export * from "./nlp/featureExtraction";
15
- export * from "./nlp/fillMask";
16
- export * from "./nlp/questionAnswering";
17
- export * from "./nlp/sentenceSimilarity";
18
- export * from "./nlp/summarization";
19
- export * from "./nlp/tableQuestionAnswering";
20
- export * from "./nlp/textClassification";
21
- export * from "./nlp/textGeneration";
22
- export * from "./nlp/textGenerationStream";
23
- export * from "./nlp/tokenClassification";
24
- export * from "./nlp/translation";
25
- export * from "./nlp/zeroShotClassification";
26
- export * from "./nlp/chatCompletion";
27
- export * from "./nlp/chatCompletionStream";
28
- export * from "./multimodal/documentQuestionAnswering";
29
- export * from "./multimodal/visualQuestionAnswering";
30
- export * from "./tabular/tabularRegression";
31
- export * from "./tabular/tabularClassification";
32
- //# sourceMappingURL=index.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tasks/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AAGjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AAGrD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts DELETED
@@ -1,35 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type DocumentQuestionAnsweringArgs = BaseArgs & {
3
- inputs: {
4
- /**
5
- * Raw image
6
- *
7
- * You can use native `File` in browsers, or `new Blob([buffer])` in node, or for a base64 image `new Blob([btoa(base64String)])`, or even `await (await fetch('...)).blob()`
8
- **/
9
- image: Blob | ArrayBuffer;
10
- question: string;
11
- };
12
- };
13
- export interface DocumentQuestionAnsweringOutput {
14
- /**
15
- * A string that’s the answer within the document.
16
- */
17
- answer: string;
18
- /**
19
- * ?
20
- */
21
- end?: number;
22
- /**
23
- * A float that represents how likely that the answer is correct
24
- */
25
- score?: number;
26
- /**
27
- * ?
28
- */
29
- start?: number;
30
- }
31
- /**
32
- * Answers a question on a document image. Recommended model: impira/layoutlm-document-qa.
33
- */
34
- export declare function documentQuestionAnswering(args: DocumentQuestionAnsweringArgs, options?: Options): Promise<DocumentQuestionAnsweringOutput>;
35
- //# sourceMappingURL=documentQuestionAnswering.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/documentQuestionAnswering.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"documentQuestionAnswering.d.ts","sourceRoot":"","sources":["../../../../src/tasks/multimodal/documentQuestionAnswering.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAMrD,MAAM,MAAM,6BAA6B,GAAG,QAAQ,GAAG;IACtD,MAAM,EAAE;QACP;;;;YAII;QACJ,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC;QAC1B,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;CACF,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC/C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC9C,IAAI,EAAE,6BAA6B,EACnC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,+BAA+B,CAAC,CA4B1C"}
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts DELETED
@@ -1,27 +0,0 @@
1
- import type { BaseArgs, Options } from "../../types";
2
- export type VisualQuestionAnsweringArgs = BaseArgs & {
3
- inputs: {
4
- /**
5
- * Raw image
6
- *
7
- * You can use native `File` in browsers, or `new Blob([buffer])` in node, or for a base64 image `new Blob([btoa(base64String)])`, or even `await (await fetch('...)).blob()`
8
- **/
9
- image: Blob | ArrayBuffer;
10
- question: string;
11
- };
12
- };
13
- export interface VisualQuestionAnsweringOutput {
14
- /**
15
- * A string that’s the answer to a visual question.
16
- */
17
- answer: string;
18
- /**
19
- * Answer correctness score.
20
- */
21
- score: number;
22
- }
23
- /**
24
- * Answers a question on an image. Recommended model: dandelin/vilt-b32-finetuned-vqa.
25
- */
26
- export declare function visualQuestionAnswering(args: VisualQuestionAnsweringArgs, options?: Options): Promise<VisualQuestionAnsweringOutput>;
27
- //# sourceMappingURL=visualQuestionAnswering.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
data/node_modules/@huggingface/inference/dist/src/tasks/multimodal/visualQuestionAnswering.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"visualQuestionAnswering.d.ts","sourceRoot":"","sources":["../../../../src/tasks/multimodal/visualQuestionAnswering.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAIlE,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG;IACpD,MAAM,EAAE;QACP;;;;YAII;QACJ,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC;QAC1B,QAAQ,EAAE,MAAM,CAAC;KACjB,CAAC;CACF,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,6BAA6B,CAAC,CAwBxC"}