@huggingface/tasks 0.13.3 → 0.13.5

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.
Files changed (93) hide show
  1. package/dist/commonjs/index.d.ts.map +1 -1
  2. package/dist/commonjs/local-apps.d.ts.map +1 -1
  3. package/dist/commonjs/local-apps.js +40 -21
  4. package/dist/commonjs/local-apps.spec.d.ts +2 -0
  5. package/dist/commonjs/local-apps.spec.d.ts.map +1 -0
  6. package/dist/commonjs/local-apps.spec.js +114 -0
  7. package/dist/commonjs/model-libraries-snippets.d.ts.map +1 -1
  8. package/dist/commonjs/model-libraries-snippets.js +23 -12
  9. package/dist/commonjs/model-libraries-snippets.spec.d.ts +2 -0
  10. package/dist/commonjs/model-libraries-snippets.spec.d.ts.map +1 -0
  11. package/dist/commonjs/model-libraries-snippets.spec.js +51 -0
  12. package/dist/commonjs/model-libraries.d.ts +8 -1
  13. package/dist/commonjs/model-libraries.d.ts.map +1 -1
  14. package/dist/commonjs/model-libraries.js +7 -0
  15. package/dist/commonjs/tasks/audio-classification/inference.d.ts +3 -0
  16. package/dist/commonjs/tasks/audio-classification/inference.d.ts.map +1 -1
  17. package/dist/commonjs/tasks/document-question-answering/inference.d.ts +0 -4
  18. package/dist/commonjs/tasks/document-question-answering/inference.d.ts.map +1 -1
  19. package/dist/commonjs/tasks/image-classification/inference.d.ts +3 -0
  20. package/dist/commonjs/tasks/image-classification/inference.d.ts.map +1 -1
  21. package/dist/commonjs/tasks/index.d.ts +1 -1
  22. package/dist/commonjs/tasks/index.d.ts.map +1 -1
  23. package/dist/commonjs/tasks/text-classification/inference.d.ts +3 -0
  24. package/dist/commonjs/tasks/text-classification/inference.d.ts.map +1 -1
  25. package/dist/commonjs/tasks/text-to-speech/data.d.ts.map +1 -1
  26. package/dist/commonjs/tasks/text-to-speech/data.js +15 -7
  27. package/dist/commonjs/tasks/video-classification/inference.d.ts +3 -0
  28. package/dist/commonjs/tasks/video-classification/inference.d.ts.map +1 -1
  29. package/dist/commonjs/tasks/zero-shot-classification/inference.d.ts +9 -19
  30. package/dist/commonjs/tasks/zero-shot-classification/inference.d.ts.map +1 -1
  31. package/dist/commonjs/tasks/zero-shot-image-classification/inference.d.ts +9 -19
  32. package/dist/commonjs/tasks/zero-shot-image-classification/inference.d.ts.map +1 -1
  33. package/dist/commonjs/tasks/zero-shot-object-detection/inference.d.ts +8 -12
  34. package/dist/commonjs/tasks/zero-shot-object-detection/inference.d.ts.map +1 -1
  35. package/dist/esm/index.d.ts.map +1 -1
  36. package/dist/esm/local-apps.d.ts.map +1 -1
  37. package/dist/esm/local-apps.js +40 -21
  38. package/dist/esm/local-apps.spec.d.ts +2 -0
  39. package/dist/esm/local-apps.spec.d.ts.map +1 -0
  40. package/dist/esm/local-apps.spec.js +112 -0
  41. package/dist/esm/model-libraries-snippets.d.ts.map +1 -1
  42. package/dist/esm/model-libraries-snippets.js +23 -12
  43. package/dist/esm/model-libraries-snippets.spec.d.ts +2 -0
  44. package/dist/esm/model-libraries-snippets.spec.d.ts.map +1 -0
  45. package/dist/esm/model-libraries-snippets.spec.js +49 -0
  46. package/dist/esm/model-libraries.d.ts +8 -1
  47. package/dist/esm/model-libraries.d.ts.map +1 -1
  48. package/dist/esm/model-libraries.js +7 -0
  49. package/dist/esm/tasks/audio-classification/inference.d.ts +3 -0
  50. package/dist/esm/tasks/audio-classification/inference.d.ts.map +1 -1
  51. package/dist/esm/tasks/document-question-answering/inference.d.ts +0 -4
  52. package/dist/esm/tasks/document-question-answering/inference.d.ts.map +1 -1
  53. package/dist/esm/tasks/image-classification/inference.d.ts +3 -0
  54. package/dist/esm/tasks/image-classification/inference.d.ts.map +1 -1
  55. package/dist/esm/tasks/index.d.ts +1 -1
  56. package/dist/esm/tasks/index.d.ts.map +1 -1
  57. package/dist/esm/tasks/text-classification/inference.d.ts +3 -0
  58. package/dist/esm/tasks/text-classification/inference.d.ts.map +1 -1
  59. package/dist/esm/tasks/text-to-speech/data.d.ts.map +1 -1
  60. package/dist/esm/tasks/text-to-speech/data.js +15 -7
  61. package/dist/esm/tasks/video-classification/inference.d.ts +3 -0
  62. package/dist/esm/tasks/video-classification/inference.d.ts.map +1 -1
  63. package/dist/esm/tasks/zero-shot-classification/inference.d.ts +9 -19
  64. package/dist/esm/tasks/zero-shot-classification/inference.d.ts.map +1 -1
  65. package/dist/esm/tasks/zero-shot-image-classification/inference.d.ts +9 -19
  66. package/dist/esm/tasks/zero-shot-image-classification/inference.d.ts.map +1 -1
  67. package/dist/esm/tasks/zero-shot-object-detection/inference.d.ts +8 -12
  68. package/dist/esm/tasks/zero-shot-object-detection/inference.d.ts.map +1 -1
  69. package/package.json +1 -1
  70. package/src/index.ts +0 -1
  71. package/src/local-apps.spec.ts +123 -0
  72. package/src/local-apps.ts +37 -18
  73. package/src/model-libraries-snippets.spec.ts +54 -0
  74. package/src/model-libraries-snippets.ts +24 -11
  75. package/src/model-libraries.ts +7 -0
  76. package/src/tasks/audio-classification/inference.ts +3 -0
  77. package/src/tasks/audio-classification/spec/input.json +2 -1
  78. package/src/tasks/document-question-answering/inference.ts +0 -4
  79. package/src/tasks/document-question-answering/spec/output.json +1 -8
  80. package/src/tasks/image-classification/inference.ts +3 -0
  81. package/src/tasks/image-classification/spec/input.json +2 -1
  82. package/src/tasks/index.ts +0 -1
  83. package/src/tasks/text-classification/inference.ts +3 -0
  84. package/src/tasks/text-classification/spec/input.json +2 -1
  85. package/src/tasks/text-to-speech/data.ts +15 -7
  86. package/src/tasks/video-classification/inference.ts +3 -0
  87. package/src/tasks/video-classification/spec/input.json +2 -1
  88. package/src/tasks/zero-shot-classification/inference.ts +9 -19
  89. package/src/tasks/zero-shot-classification/spec/input.json +13 -20
  90. package/src/tasks/zero-shot-image-classification/inference.ts +9 -19
  91. package/src/tasks/zero-shot-image-classification/spec/input.json +13 -19
  92. package/src/tasks/zero-shot-object-detection/inference.ts +8 -12
  93. package/src/tasks/zero-shot-object-detection/spec/input.json +13 -18
@@ -102,9 +102,5 @@ export interface DocumentQuestionAnsweringOutputElement {
102
102
  * boxes).
103
103
  */
104
104
  start: number;
105
- /**
106
- * The index of each word/box pair that is in the answer
107
- */
108
- words: number[];
109
105
  [property: string]: unknown;
110
106
  }
@@ -22,15 +22,8 @@
22
22
  "end": {
23
23
  "type": "integer",
24
24
  "description": "The end word index of the answer (in the OCR\u2019d version of the input or provided word boxes)."
25
- },
26
- "words": {
27
- "type": "array",
28
- "items": {
29
- "type": "integer"
30
- },
31
- "description": "The index of each word/box pair that is in the answer"
32
25
  }
33
26
  },
34
- "required": ["answer", "score", "start", "end", "words"]
27
+ "required": ["answer", "score", "start", "end"]
35
28
  }
36
29
  }
@@ -24,6 +24,9 @@ export interface ImageClassificationInput {
24
24
  * Additional inference parameters for Image Classification
25
25
  */
26
26
  export interface ImageClassificationParameters {
27
+ /**
28
+ * The function to apply to the model outputs in order to retrieve the scores.
29
+ */
27
30
  function_to_apply?: ClassificationOutputTransform;
28
31
  /**
29
32
  * When specified, limits the output to the top K most probable classes.
@@ -22,7 +22,8 @@
22
22
  "properties": {
23
23
  "function_to_apply": {
24
24
  "title": "ImageClassificationOutputTransform",
25
- "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
25
+ "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform",
26
+ "description": "The function to apply to the model outputs in order to retrieve the scores."
26
27
  },
27
28
  "top_k": {
28
29
  "type": "integer",
@@ -102,7 +102,6 @@ export type * from "./zero-shot-image-classification/inference.js";
102
102
  export type {
103
103
  BoundingBox,
104
104
  ZeroShotObjectDetectionInput,
105
- ZeroShotObjectDetectionInputData,
106
105
  ZeroShotObjectDetectionOutput,
107
106
  ZeroShotObjectDetectionOutputElement,
108
107
  } from "./zero-shot-object-detection/inference.js";
@@ -23,6 +23,9 @@ export interface TextClassificationInput {
23
23
  * Additional inference parameters for Text Classification
24
24
  */
25
25
  export interface TextClassificationParameters {
26
+ /**
27
+ * The function to apply to the model outputs in order to retrieve the scores.
28
+ */
26
29
  function_to_apply?: ClassificationOutputTransform;
27
30
  /**
28
31
  * When specified, limits the output to the top K most probable classes.
@@ -22,7 +22,8 @@
22
22
  "properties": {
23
23
  "function_to_apply": {
24
24
  "title": "TextClassificationOutputTransform",
25
- "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
25
+ "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform",
26
+ "description": "The function to apply to the model outputs in order to retrieve the scores."
26
27
  },
27
28
  "top_k": {
28
29
  "type": "integer",
@@ -11,6 +11,10 @@ const taskData: TaskDataCustom = {
11
11
  description: "Multi-speaker English dataset.",
12
12
  id: "mythicinfinity/libritts_r",
13
13
  },
14
+ {
15
+ description: "Mulit-lingual dataset.",
16
+ id: "facebook/multilingual_librispeech",
17
+ },
14
18
  ],
15
19
  demo: {
16
20
  inputs: [
@@ -35,20 +39,24 @@ const taskData: TaskDataCustom = {
35
39
  ],
36
40
  models: [
37
41
  {
38
- description: "A powerful TTS model.",
42
+ description: "A prompt based, powerful TTS model.",
39
43
  id: "parler-tts/parler-tts-large-v1",
40
44
  },
45
+ {
46
+ description: "A powerful TTS model that supports English and Chinese.",
47
+ id: "SWivid/F5-TTS",
48
+ },
41
49
  {
42
50
  description: "A massively multi-lingual TTS model.",
43
51
  id: "coqui/XTTS-v2",
44
52
  },
45
53
  {
46
- description: "Robust TTS model.",
47
- id: "metavoiceio/metavoice-1B-v0.1",
54
+ description: "A powerful TTS model.",
55
+ id: "amphion/MaskGCT",
48
56
  },
49
57
  {
50
- description: "A prompt based, powerful TTS model.",
51
- id: "parler-tts/parler_tts_mini_v0.1",
58
+ description: "A Llama based TTS model.",
59
+ id: "OuteAI/OuteTTS-0.1-350M",
52
60
  },
53
61
  ],
54
62
  spaces: [
@@ -66,8 +74,8 @@ const taskData: TaskDataCustom = {
66
74
  id: "mrfakename/E2-F5-TTS",
67
75
  },
68
76
  {
69
- description: "An application that synthesizes speech for diverse speaker prompts.",
70
- id: "parler-tts/parler_tts_mini",
77
+ description: "An application that synthesizes emotional speech for diverse speaker prompts.",
78
+ id: "parler-tts/parler-tts-expresso",
71
79
  },
72
80
  ],
73
81
  summary:
@@ -27,6 +27,9 @@ export interface VideoClassificationParameters {
27
27
  * The sampling rate used to select frames from the video.
28
28
  */
29
29
  frame_sampling_rate?: number;
30
+ /**
31
+ * The function to apply to the model outputs in order to retrieve the scores.
32
+ */
30
33
  function_to_apply?: ClassificationOutputTransform;
31
34
  /**
32
35
  * The number of sampled frames to consider for classification.
@@ -21,7 +21,8 @@
21
21
  "properties": {
22
22
  "function_to_apply": {
23
23
  "title": "TextClassificationOutputTransform",
24
- "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform"
24
+ "$ref": "/inference/schemas/common-definitions.json#/definitions/ClassificationOutputTransform",
25
+ "description": "The function to apply to the model outputs in order to retrieve the scores."
25
26
  },
26
27
  "num_frames": {
27
28
  "type": "integer",
@@ -8,27 +8,13 @@
8
8
  */
9
9
  export interface ZeroShotClassificationInput {
10
10
  /**
11
- * The input text data, with candidate labels
11
+ * The text to classify
12
12
  */
13
- inputs: ZeroShotClassificationInputData;
13
+ inputs: string;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
17
- parameters?: ZeroShotClassificationParameters;
18
- [property: string]: unknown;
19
- }
20
- /**
21
- * The input text data, with candidate labels
22
- */
23
- export interface ZeroShotClassificationInputData {
24
- /**
25
- * The set of possible class labels to classify the text into.
26
- */
27
- candidateLabels: string[];
28
- /**
29
- * The text to classify
30
- */
31
- text: string;
17
+ parameters: ZeroShotClassificationParameters;
32
18
  [property: string]: unknown;
33
19
  }
34
20
  /**
@@ -38,8 +24,12 @@ export interface ZeroShotClassificationInputData {
38
24
  */
39
25
  export interface ZeroShotClassificationParameters {
40
26
  /**
41
- * The sentence used in conjunction with candidateLabels to attempt the text classification
42
- * by replacing the placeholder with the candidate labels.
27
+ * The set of possible class labels to classify the text into.
28
+ */
29
+ candidate_labels: string[];
30
+ /**
31
+ * The sentence used in conjunction with `candidate_labels` to attempt the text
32
+ * classification by replacing the placeholder with the candidate labels.
43
33
  */
44
34
  hypothesis_template?: string;
45
35
  /**
@@ -6,23 +6,8 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "inputs": {
9
- "description": "The input text data, with candidate labels",
10
- "type": "object",
11
- "title": "ZeroShotClassificationInputData",
12
- "properties": {
13
- "text": {
14
- "type": "string",
15
- "description": "The text to classify"
16
- },
17
- "candidateLabels": {
18
- "type": "array",
19
- "description": "The set of possible class labels to classify the text into.",
20
- "items": {
21
- "type": "string"
22
- }
23
- }
24
- },
25
- "required": ["text", "candidateLabels"]
9
+ "description": "The text to classify",
10
+ "type": "string"
26
11
  },
27
12
  "parameters": {
28
13
  "description": "Additional inference parameters",
@@ -35,16 +20,24 @@
35
20
  "description": "Additional inference parameters for Zero Shot Classification",
36
21
  "type": "object",
37
22
  "properties": {
23
+ "candidate_labels": {
24
+ "type": "array",
25
+ "description": "The set of possible class labels to classify the text into.",
26
+ "items": {
27
+ "type": "string"
28
+ }
29
+ },
38
30
  "hypothesis_template": {
39
31
  "type": "string",
40
- "description": "The sentence used in conjunction with candidateLabels to attempt the text classification by replacing the placeholder with the candidate labels."
32
+ "description": "The sentence used in conjunction with `candidate_labels` to attempt the text classification by replacing the placeholder with the candidate labels."
41
33
  },
42
34
  "multi_label": {
43
35
  "type": "boolean",
44
36
  "description": "Whether multiple candidate labels can be true. If false, the scores are normalized such that the sum of the label likelihoods for each sequence is 1. If true, the labels are considered independent and probabilities are normalized for each candidate."
45
37
  }
46
- }
38
+ },
39
+ "required": ["candidate_labels"]
47
40
  }
48
41
  },
49
- "required": ["inputs"]
42
+ "required": ["inputs", "parameters"]
50
43
  }
@@ -8,27 +8,13 @@
8
8
  */
9
9
  export interface ZeroShotImageClassificationInput {
10
10
  /**
11
- * The input image data, with candidate labels
11
+ * The input image data to classify as a base64-encoded string.
12
12
  */
13
- inputs: ZeroShotImageClassificationInputData;
13
+ inputs: string;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
17
- parameters?: ZeroShotImageClassificationParameters;
18
- [property: string]: unknown;
19
- }
20
- /**
21
- * The input image data, with candidate labels
22
- */
23
- export interface ZeroShotImageClassificationInputData {
24
- /**
25
- * The candidate labels for this image
26
- */
27
- candidateLabels: string[];
28
- /**
29
- * The image data to classify
30
- */
31
- image: unknown;
17
+ parameters: ZeroShotImageClassificationParameters;
32
18
  [property: string]: unknown;
33
19
  }
34
20
  /**
@@ -38,8 +24,12 @@ export interface ZeroShotImageClassificationInputData {
38
24
  */
39
25
  export interface ZeroShotImageClassificationParameters {
40
26
  /**
41
- * The sentence used in conjunction with candidateLabels to attempt the text classification
42
- * by replacing the placeholder with the candidate labels.
27
+ * The candidate labels for this image
28
+ */
29
+ candidate_labels: string[];
30
+ /**
31
+ * The sentence used in conjunction with `candidate_labels` to attempt the image
32
+ * classification by replacing the placeholder with the candidate labels.
43
33
  */
44
34
  hypothesis_template?: string;
45
35
  [property: string]: unknown;
@@ -6,22 +6,8 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "inputs": {
9
- "description": "The input image data, with candidate labels",
10
- "type": "object",
11
- "title": "ZeroShotImageClassificationInputData",
12
- "properties": {
13
- "image": {
14
- "description": "The image data to classify"
15
- },
16
- "candidateLabels": {
17
- "description": "The candidate labels for this image",
18
- "type": "array",
19
- "items": {
20
- "type": "string"
21
- }
22
- }
23
- },
24
- "required": ["image", "candidateLabels"]
9
+ "type": "string",
10
+ "description": "The input image data to classify as a base64-encoded string."
25
11
  },
26
12
  "parameters": {
27
13
  "description": "Additional inference parameters",
@@ -34,12 +20,20 @@
34
20
  "description": "Additional inference parameters for Zero Shot Image Classification",
35
21
  "type": "object",
36
22
  "properties": {
23
+ "candidate_labels": {
24
+ "description": "The candidate labels for this image",
25
+ "type": "array",
26
+ "items": {
27
+ "type": "string"
28
+ }
29
+ },
37
30
  "hypothesis_template": {
38
31
  "type": "string",
39
- "description": "The sentence used in conjunction with candidateLabels to attempt the text classification by replacing the placeholder with the candidate labels."
32
+ "description": "The sentence used in conjunction with `candidate_labels` to attempt the image classification by replacing the placeholder with the candidate labels."
40
33
  }
41
- }
34
+ },
35
+ "required": ["candidate_labels"]
42
36
  }
43
37
  },
44
- "required": ["inputs"]
38
+ "required": ["inputs", "parameters"]
45
39
  }
@@ -8,29 +8,25 @@
8
8
  */
9
9
  export interface ZeroShotObjectDetectionInput {
10
10
  /**
11
- * The input image data, with candidate labels
11
+ * The input image data as a base64-encoded string.
12
12
  */
13
- inputs: ZeroShotObjectDetectionInputData;
13
+ inputs: string;
14
14
  /**
15
15
  * Additional inference parameters
16
16
  */
17
- parameters?: {
18
- [key: string]: unknown;
19
- };
17
+ parameters: ZeroShotObjectDetectionParameters;
20
18
  [property: string]: unknown;
21
19
  }
22
20
  /**
23
- * The input image data, with candidate labels
21
+ * Additional inference parameters
22
+ *
23
+ * Additional inference parameters for Zero Shot Object Detection
24
24
  */
25
- export interface ZeroShotObjectDetectionInputData {
25
+ export interface ZeroShotObjectDetectionParameters {
26
26
  /**
27
27
  * The candidate labels for this image
28
28
  */
29
- candidateLabels: string[];
30
- /**
31
- * The image data to generate bounding boxes from
32
- */
33
- image: unknown;
29
+ candidate_labels: string[];
34
30
  [property: string]: unknown;
35
31
  }
36
32
  /**
@@ -6,22 +6,8 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "inputs": {
9
- "description": "The input image data, with candidate labels",
10
- "type": "object",
11
- "title": "ZeroShotObjectDetectionInputData",
12
- "properties": {
13
- "image": {
14
- "description": "The image data to generate bounding boxes from"
15
- },
16
- "candidateLabels": {
17
- "description": "The candidate labels for this image",
18
- "type": "array",
19
- "items": {
20
- "type": "string"
21
- }
22
- }
23
- },
24
- "required": ["image", "candidateLabels"]
9
+ "description": "The input image data as a base64-encoded string.",
10
+ "type": "string"
25
11
  },
26
12
  "parameters": {
27
13
  "description": "Additional inference parameters",
@@ -33,8 +19,17 @@
33
19
  "title": "ZeroShotObjectDetectionParameters",
34
20
  "description": "Additional inference parameters for Zero Shot Object Detection",
35
21
  "type": "object",
36
- "properties": {}
22
+ "properties": {
23
+ "candidate_labels": {
24
+ "description": "The candidate labels for this image",
25
+ "type": "array",
26
+ "items": {
27
+ "type": "string"
28
+ }
29
+ }
30
+ },
31
+ "required": ["candidate_labels"]
37
32
  }
38
33
  },
39
- "required": ["inputs"]
34
+ "required": ["inputs", "parameters"]
40
35
  }