@huggingface/inference 2.5.0 → 2.5.2

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.d.ts CHANGED
@@ -167,11 +167,11 @@ export type ImageClassificationArgs = BaseArgs & {
167
167
  export type ImageClassificationOutput = ImageClassificationOutputValue[];
168
168
  export interface ImageClassificationOutputValue {
169
169
  /**
170
- * A float that represents how likely it is that the image file belongs to this class.
170
+ * The label for the class (model specific)
171
171
  */
172
172
  label: string;
173
173
  /**
174
- * The label for the class (model specific)
174
+ * A float that represents how likely it is that the image file belongs to this class.
175
175
  */
176
176
  score: number;
177
177
  }
@@ -509,7 +509,7 @@ export type FeatureExtractionArgs = BaseArgs & {
509
509
  inputs: string | string[];
510
510
  };
511
511
  /**
512
- * Returned values are a list of floats, or a list of list of floats, or a list of list of list of floats (depending on if you sent a string or a list of string, and if the automatic reduction, usually mean_pooling for instance was applied for you or not. This should be explained on the model's README.
512
+ * Returned values are a multidimensional array of floats (dimension depending on if you sent a string or a list of string, and if the automatic reduction, usually mean_pooling for instance was applied for you or not. This should be explained on the model's README).
513
513
  */
514
514
  export type FeatureExtractionOutput = (number | number[] | number[][])[];
515
515
  /**
package/dist/index.js CHANGED
@@ -558,9 +558,9 @@ async function featureExtraction(args, options) {
558
558
  return arr.every((x) => typeof x === "number");
559
559
  }
560
560
  };
561
- isValidOutput = Array.isArray(res) && isNumArrayRec(res, 2, 0);
561
+ isValidOutput = Array.isArray(res) && isNumArrayRec(res, 3, 0);
562
562
  if (!isValidOutput) {
563
- throw new InferenceOutputError("Expected Array<number[][] | number[] | number>");
563
+ throw new InferenceOutputError("Expected Array<number[][][] | number[][] | number[] | number>");
564
564
  }
565
565
  return res;
566
566
  }
package/dist/index.mjs CHANGED
@@ -506,9 +506,9 @@ async function featureExtraction(args, options) {
506
506
  return arr.every((x) => typeof x === "number");
507
507
  }
508
508
  };
509
- isValidOutput = Array.isArray(res) && isNumArrayRec(res, 2, 0);
509
+ isValidOutput = Array.isArray(res) && isNumArrayRec(res, 3, 0);
510
510
  if (!isValidOutput) {
511
- throw new InferenceOutputError("Expected Array<number[][] | number[] | number>");
511
+ throw new InferenceOutputError("Expected Array<number[][][] | number[][] | number[] | number>");
512
512
  }
513
513
  return res;
514
514
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huggingface/inference",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "packageManager": "pnpm@8.3.1",
5
5
  "license": "MIT",
6
6
  "author": "Tim Mikeladze <tim.mikeladze@gmail.com>",
@@ -11,11 +11,11 @@ export type ImageClassificationArgs = BaseArgs & {
11
11
 
12
12
  export interface ImageClassificationOutputValue {
13
13
  /**
14
- * A float that represents how likely it is that the image file belongs to this class.
14
+ * The label for the class (model specific)
15
15
  */
16
16
  label: string;
17
17
  /**
18
- * The label for the class (model specific)
18
+ * A float that represents how likely it is that the image file belongs to this class.
19
19
  */
20
20
  score: number;
21
21
  }
@@ -14,7 +14,7 @@ export type FeatureExtractionArgs = BaseArgs & {
14
14
  };
15
15
 
16
16
  /**
17
- * Returned values are a list of floats, or a list of list of floats, or a list of list of list of floats (depending on if you sent a string or a list of string, and if the automatic reduction, usually mean_pooling for instance was applied for you or not. This should be explained on the model's README.
17
+ * Returned values are a multidimensional array of floats (dimension depending on if you sent a string or a list of string, and if the automatic reduction, usually mean_pooling for instance was applied for you or not. This should be explained on the model's README).
18
18
  */
19
19
  export type FeatureExtractionOutput = (number | number[] | number[][])[];
20
20
 
@@ -46,10 +46,10 @@ export async function featureExtraction(
46
46
  }
47
47
  };
48
48
 
49
- isValidOutput = Array.isArray(res) && isNumArrayRec(res, 2, 0);
49
+ isValidOutput = Array.isArray(res) && isNumArrayRec(res, 3, 0);
50
50
 
51
51
  if (!isValidOutput) {
52
- throw new InferenceOutputError("Expected Array<number[][] | number[] | number>");
52
+ throw new InferenceOutputError("Expected Array<number[][][] | number[][] | number[] | number>");
53
53
  }
54
54
  return res;
55
55
  }