@huggingface/inference 2.3.1 → 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 CHANGED
@@ -11,9 +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
+ pnpm add @huggingface/inference
15
+
14
16
  yarn add @huggingface/inference
17
+ ```
15
18
 
16
- pnpm add @huggingface/inference
19
+ ### Deno
20
+
21
+ ```ts
22
+ // esm.sh
23
+ import { HfInference } from "https://esm.sh/@huggingface/inference"
24
+ // or npm:
25
+ import { HfInference } from "npm:@huggingface/inference"
17
26
  ```
18
27
 
19
28
  ## Usage
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference path="./index.d.ts" />
1
2
  "use strict";
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference path="./index.d.ts" />
1
2
  var __defProp = Object.defineProperty;
2
3
  var __export = (target, all) => {
3
4
  for (var name in all)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "2.3.1",
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>",
@@ -42,12 +42,8 @@
42
42
  "ts-node": "^10.9.1",
43
43
  "typescript": "^5.0.4",
44
44
  "vite": "^4.1.4",
45
- "vitest": "^0.29.8",
46
- "@huggingface/shared": "1.0.0"
45
+ "vitest": "^0.29.8"
47
46
  },
48
- "bundledDependencies": [
49
- "@huggingface/shared"
50
- ],
51
47
  "resolutions": {},
52
48
  "scripts": {
53
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 "@huggingface/shared";
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 "@huggingface/shared";
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 "@huggingface/shared";
4
+ import { base64FromBytes } from "../../../../shared";
5
5
 
6
6
  export type VisualQuestionAnsweringArgs = BaseArgs & {
7
7
  inputs: {
@@ -1,8 +0,0 @@
1
- {
2
- "name": "@huggingface/shared",
3
- "version": "1.0.0",
4
- "private": true,
5
- "main": "src/index.ts",
6
- "source": "src/index.ts",
7
- "types": "./src/index.ts"
8
- }
@@ -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,3 +0,0 @@
1
- export * from './base64FromBytes';
2
- export * from './isBackend';
3
- export * from './isFrontend';
@@ -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,3 +0,0 @@
1
- import { isBackend } from "./isBackend";
2
-
3
- export const isFrontend = !isBackend;
@@ -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
- }