@huggingface/inference 2.1.3-test → 2.1.3-test2

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/dist/index.js CHANGED
@@ -543,7 +543,7 @@ async function zeroShotClassification(args, options) {
543
543
  return res;
544
544
  }
545
545
 
546
- // src/utils/base64FromBytes.ts
546
+ // ../shared/src/base64FromBytes.ts
547
547
  function base64FromBytes(arr) {
548
548
  if (globalThis.Buffer) {
549
549
  return globalThis.Buffer.from(arr).toString("base64");
@@ -556,6 +556,10 @@ function base64FromBytes(arr) {
556
556
  }
557
557
  }
558
558
 
559
+ // ../shared/src/isBackend.ts
560
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
561
+ var isWebWorker = typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
562
+
559
563
  // src/tasks/multimodal/documentQuestionAnswering.ts
560
564
  async function documentQuestionAnswering(args, options) {
561
565
  const reqArgs = {
package/dist/index.mjs CHANGED
@@ -498,7 +498,7 @@ async function zeroShotClassification(args, options) {
498
498
  return res;
499
499
  }
500
500
 
501
- // src/utils/base64FromBytes.ts
501
+ // ../shared/src/base64FromBytes.ts
502
502
  function base64FromBytes(arr) {
503
503
  if (globalThis.Buffer) {
504
504
  return globalThis.Buffer.from(arr).toString("base64");
@@ -511,6 +511,10 @@ function base64FromBytes(arr) {
511
511
  }
512
512
  }
513
513
 
514
+ // ../shared/src/isBackend.ts
515
+ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
516
+ var isWebWorker = typeof self === "object" && self.constructor && self.constructor.name === "DedicatedWorkerGlobalScope";
517
+
514
518
  // src/tasks/multimodal/documentQuestionAnswering.ts
515
519
  async function documentQuestionAnswering(args, options) {
516
520
  const reqArgs = {
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ export * from './base64FromBytes';
2
+ export * from './isBackend';
3
+ export * from './isFrontend';
@@ -0,0 +1,14 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "2.1.3-test",
3
+ "version": "2.1.3-test2",
4
4
  "license": "MIT",
5
5
  "author": "Tim Mikeladze <tim.mikeladze@gmail.com>",
6
6
  "description": "Typescript wrapper for the Hugging Face Inference API",
@@ -40,8 +40,12 @@
40
40
  "@types/node": "18.13.0",
41
41
  "typescript": "^5.0.4",
42
42
  "vite": "^4.1.4",
43
- "vitest": "^0.29.8"
43
+ "vitest": "^0.29.8",
44
+ "@huggingface/shared": "1.0.0"
44
45
  },
46
+ "bundledDependencies": [
47
+ "@huggingface/shared"
48
+ ],
45
49
  "resolutions": {},
46
50
  "scripts": {
47
51
  "build": "tsup src/index.ts --format cjs,esm --clean",
@@ -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 "../../utils/base64FromBytes";
5
+ import { base64FromBytes } from "@huggingface/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 "../../utils/base64FromBytes";
4
+ import { base64FromBytes } from "@huggingface/shared";
5
5
 
6
6
  export type VisualQuestionAnsweringArgs = BaseArgs & {
7
7
  inputs: {