@huggingface/inference 2.3.2 → 2.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/package.json +1 -4
- package/src/tasks/cv/imageToImage.ts +1 -1
- package/src/tasks/multimodal/documentQuestionAnswering.ts +1 -1
- package/src/tasks/multimodal/visualQuestionAnswering.ts +1 -1
- package/node_modules/@huggingface/shared/package.json +0 -8
- package/node_modules/@huggingface/shared/src/base64FromBytes.ts +0 -11
- package/node_modules/@huggingface/shared/src/index.ts +0 -3
- package/node_modules/@huggingface/shared/src/isBackend.ts +0 -6
- package/node_modules/@huggingface/shared/src/isFrontend.ts +0 -3
- package/node_modules/@huggingface/shared/tsconfig.json +0 -14
package/README.md
CHANGED
|
@@ -11,16 +11,18 @@ You can also try out a live [interactive notebook](https://observablehq.com/@hug
|
|
|
11
11
|
```console
|
|
12
12
|
npm install @huggingface/inference
|
|
13
13
|
|
|
14
|
-
yarn add @huggingface/inference
|
|
15
|
-
|
|
16
14
|
pnpm add @huggingface/inference
|
|
15
|
+
|
|
16
|
+
yarn add @huggingface/inference
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
### Deno
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
//
|
|
23
|
-
import { HfInference } from "https://
|
|
21
|
+
```ts
|
|
22
|
+
// esm.sh
|
|
23
|
+
import { HfInference } from "https://esm.sh/@huggingface/inference"
|
|
24
|
+
// or npm:
|
|
25
|
+
import { HfInference } from "npm:@huggingface/inference"
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
## Usage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huggingface/inference",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"packageManager": "pnpm@8.3.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Tim Mikeladze <tim.mikeladze@gmail.com>",
|
|
@@ -44,9 +44,6 @@
|
|
|
44
44
|
"vite": "^4.1.4",
|
|
45
45
|
"vitest": "^0.29.8"
|
|
46
46
|
},
|
|
47
|
-
"bundledDependencies": [
|
|
48
|
-
"@huggingface/shared"
|
|
49
|
-
],
|
|
50
47
|
"resolutions": {},
|
|
51
48
|
"scripts": {
|
|
52
49
|
"build": "tsup src/index.ts --format cjs,esm --clean && pnpm run dts",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InferenceOutputError } from "../../lib/InferenceOutputError";
|
|
2
2
|
import type { BaseArgs, Options, RequestArgs } from "../../types";
|
|
3
3
|
import { request } from "../custom/request";
|
|
4
|
-
import { base64FromBytes } from "
|
|
4
|
+
import { base64FromBytes } from "../../../../shared";
|
|
5
5
|
|
|
6
6
|
export type ImageToImageArgs = BaseArgs & {
|
|
7
7
|
/**
|
|
@@ -2,7 +2,7 @@ import { InferenceOutputError } from "../../lib/InferenceOutputError";
|
|
|
2
2
|
import type { BaseArgs, Options } from "../../types";
|
|
3
3
|
import { request } from "../custom/request";
|
|
4
4
|
import type { RequestArgs } from "../../types";
|
|
5
|
-
import { base64FromBytes } from "
|
|
5
|
+
import { base64FromBytes } from "../../../../shared";
|
|
6
6
|
import { toArray } from "../../utils/toArray";
|
|
7
7
|
|
|
8
8
|
export type DocumentQuestionAnsweringArgs = BaseArgs & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InferenceOutputError } from "../../lib/InferenceOutputError";
|
|
2
2
|
import type { BaseArgs, Options, RequestArgs } from "../../types";
|
|
3
3
|
import { request } from "../custom/request";
|
|
4
|
-
import { base64FromBytes } from "
|
|
4
|
+
import { base64FromBytes } from "../../../../shared";
|
|
5
5
|
|
|
6
6
|
export type VisualQuestionAnsweringArgs = BaseArgs & {
|
|
7
7
|
inputs: {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function base64FromBytes(arr: Uint8Array): string {
|
|
2
|
-
if (globalThis.Buffer) {
|
|
3
|
-
return globalThis.Buffer.from(arr).toString("base64");
|
|
4
|
-
} else {
|
|
5
|
-
const bin: string[] = [];
|
|
6
|
-
arr.forEach((byte) => {
|
|
7
|
-
bin.push(String.fromCharCode(byte));
|
|
8
|
-
});
|
|
9
|
-
return globalThis.btoa(bin.join(""));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
2
|
-
|
|
3
|
-
const isWebWorker =
|
|
4
|
-
typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
|
|
5
|
-
|
|
6
|
-
export const isBackend = !isBrowser && !isWebWorker;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"esModuleInterop": true,
|
|
4
|
-
"noEmit": false,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"target": "ESNext",
|
|
7
|
-
"moduleResolution": "Node",
|
|
8
|
-
"noImplicitAny": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"strictNullChecks": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"composite": true
|
|
13
|
-
}
|
|
14
|
-
}
|