@huggingface/tasks 0.11.12 → 0.11.13
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.cjs +64 -0
- package/dist/index.js +64 -0
- package/dist/src/model-libraries-snippets.d.ts +1 -0
- package/dist/src/model-libraries-snippets.d.ts.map +1 -1
- package/dist/src/model-libraries.d.ts +15 -2
- package/dist/src/model-libraries.d.ts.map +1 -1
- package/dist/src/pipelines.d.ts +12 -2
- package/dist/src/pipelines.d.ts.map +1 -1
- package/dist/src/tasks/audio-classification/inference.d.ts +3 -2
- package/dist/src/tasks/audio-classification/inference.d.ts.map +1 -1
- package/dist/src/tasks/automatic-speech-recognition/inference.d.ts +3 -2
- package/dist/src/tasks/automatic-speech-recognition/inference.d.ts.map +1 -1
- package/dist/src/tasks/image-classification/inference.d.ts +3 -2
- package/dist/src/tasks/image-classification/inference.d.ts.map +1 -1
- package/dist/src/tasks/image-segmentation/inference.d.ts +10 -6
- package/dist/src/tasks/image-segmentation/inference.d.ts.map +1 -1
- package/dist/src/tasks/image-to-image/inference.d.ts +6 -5
- package/dist/src/tasks/image-to-image/inference.d.ts.map +1 -1
- package/dist/src/tasks/index.d.ts +1 -1
- package/dist/src/tasks/index.d.ts.map +1 -1
- package/dist/src/tasks/keypoint-detection/data.d.ts +4 -0
- package/dist/src/tasks/keypoint-detection/data.d.ts.map +1 -0
- package/dist/src/tasks/object-detection/inference.d.ts +17 -4
- package/dist/src/tasks/object-detection/inference.d.ts.map +1 -1
- package/dist/src/tasks/summarization/inference.d.ts +13 -12
- package/dist/src/tasks/summarization/inference.d.ts.map +1 -1
- package/dist/src/tasks/text-to-image/inference.d.ts +2 -2
- package/dist/src/tasks/translation/inference.d.ts +21 -10
- package/dist/src/tasks/translation/inference.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/model-libraries-snippets.ts +42 -0
- package/src/model-libraries.ts +13 -0
- package/src/pipelines.ts +12 -0
- package/src/tasks/audio-classification/inference.ts +3 -2
- package/src/tasks/audio-classification/spec/input.json +2 -1
- package/src/tasks/audio-classification/spec/output.json +1 -0
- package/src/tasks/automatic-speech-recognition/inference.ts +3 -2
- package/src/tasks/automatic-speech-recognition/spec/input.json +2 -1
- package/src/tasks/common-definitions.json +3 -20
- package/src/tasks/image-classification/inference.ts +3 -2
- package/src/tasks/image-classification/spec/input.json +2 -1
- package/src/tasks/image-classification/spec/output.json +1 -0
- package/src/tasks/image-segmentation/inference.ts +10 -6
- package/src/tasks/image-segmentation/spec/input.json +3 -12
- package/src/tasks/image-segmentation/spec/output.json +4 -3
- package/src/tasks/image-to-image/inference.ts +6 -5
- package/src/tasks/image-to-image/spec/input.json +3 -2
- package/src/tasks/image-to-image/spec/output.json +1 -1
- package/src/tasks/index.ts +3 -6
- package/src/tasks/keypoint-detection/about.md +59 -0
- package/src/tasks/keypoint-detection/data.ts +46 -0
- package/src/tasks/object-detection/inference.ts +17 -4
- package/src/tasks/object-detection/spec/input.json +2 -1
- package/src/tasks/object-detection/spec/output.json +10 -6
- package/src/tasks/summarization/inference.ts +13 -12
- package/src/tasks/summarization/spec/input.json +37 -2
- package/src/tasks/text-classification/spec/output.json +1 -0
- package/src/tasks/text-to-image/inference.ts +2 -2
- package/src/tasks/text-to-image/spec/input.json +1 -1
- package/src/tasks/text-to-image/spec/output.json +1 -1
- package/src/tasks/translation/inference.ts +21 -10
- package/src/tasks/translation/spec/input.json +45 -2
- package/src/tasks/zero-shot-classification/spec/output.json +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TaskDataCustom } from "..";
|
|
2
|
+
|
|
3
|
+
const taskData: TaskDataCustom = {
|
|
4
|
+
datasets: [
|
|
5
|
+
{
|
|
6
|
+
description: "A dataset of hand keypoints of over 500k examples.",
|
|
7
|
+
id: "Vincent-luo/hagrid-mediapipe-hands",
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
demo: {
|
|
11
|
+
inputs: [
|
|
12
|
+
{
|
|
13
|
+
filename: "keypoint-detection-input.png",
|
|
14
|
+
type: "img",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
outputs: [
|
|
18
|
+
{
|
|
19
|
+
filename: "keypoint-detection-output.png",
|
|
20
|
+
type: "img",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
metrics: [],
|
|
25
|
+
models: [
|
|
26
|
+
{
|
|
27
|
+
description: "A robust keypoint detection model.",
|
|
28
|
+
id: "magic-leap-community/superpoint",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
description: "Strong keypoint detection model used to detect human pose.",
|
|
32
|
+
id: "qualcomm/MediaPipe-Pose-Estimation",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
spaces: [
|
|
36
|
+
{
|
|
37
|
+
description: "An application that detects hand keypoints in real-time.",
|
|
38
|
+
id: "datasciencedojo/Hand-Keypoint-Detection-Realtime",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
summary: "Keypoint detection is the task of identifying meaningful distinctive points or features in an image.",
|
|
42
|
+
widgetModels: [],
|
|
43
|
+
youtubeId: "",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default taskData;
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export interface ObjectDetectionInput {
|
|
10
10
|
/**
|
|
11
|
-
* The input image data
|
|
11
|
+
* The input image data as a base64-encoded string. If no `parameters` are provided, you can
|
|
12
|
+
* also provide the image data as a raw bytes payload.
|
|
12
13
|
*/
|
|
13
|
-
inputs:
|
|
14
|
+
inputs: string;
|
|
14
15
|
/**
|
|
15
16
|
* Additional inference parameters
|
|
16
17
|
*/
|
|
@@ -34,9 +35,21 @@ export interface ObjectDetectionParameters {
|
|
|
34
35
|
* image.
|
|
35
36
|
*/
|
|
36
37
|
export interface BoundingBox {
|
|
38
|
+
/**
|
|
39
|
+
* The x-coordinate of the bottom-right corner of the bounding box.
|
|
40
|
+
*/
|
|
37
41
|
xmax: number;
|
|
42
|
+
/**
|
|
43
|
+
* The x-coordinate of the top-left corner of the bounding box.
|
|
44
|
+
*/
|
|
38
45
|
xmin: number;
|
|
46
|
+
/**
|
|
47
|
+
* The y-coordinate of the bottom-right corner of the bounding box.
|
|
48
|
+
*/
|
|
39
49
|
ymax: number;
|
|
50
|
+
/**
|
|
51
|
+
* The y-coordinate of the top-left corner of the bounding box.
|
|
52
|
+
*/
|
|
40
53
|
ymin: number;
|
|
41
54
|
[property: string]: unknown;
|
|
42
55
|
}
|
|
@@ -51,11 +64,11 @@ export interface ObjectDetectionOutputElement {
|
|
|
51
64
|
*/
|
|
52
65
|
box: BoundingBox;
|
|
53
66
|
/**
|
|
54
|
-
* The predicted label for the bounding box
|
|
67
|
+
* The predicted label for the bounding box.
|
|
55
68
|
*/
|
|
56
69
|
label: string;
|
|
57
70
|
/**
|
|
58
|
-
* The associated score / probability
|
|
71
|
+
* The associated score / probability.
|
|
59
72
|
*/
|
|
60
73
|
score: number;
|
|
61
74
|
[property: string]: unknown;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"inputs": {
|
|
9
|
-
"
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The input image data as a base64-encoded string. If no `parameters` are provided, you can also provide the image data as a raw bytes payload."
|
|
10
11
|
},
|
|
11
12
|
"parameters": {
|
|
12
13
|
"description": "Additional inference parameters",
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"properties": {
|
|
10
10
|
"label": {
|
|
11
11
|
"type": "string",
|
|
12
|
-
"description": "The predicted label for the bounding box"
|
|
12
|
+
"description": "The predicted label for the bounding box."
|
|
13
13
|
},
|
|
14
14
|
"score": {
|
|
15
15
|
"type": "number",
|
|
16
|
-
"description": "The associated score / probability"
|
|
16
|
+
"description": "The associated score / probability."
|
|
17
17
|
},
|
|
18
18
|
"box": {
|
|
19
19
|
"$ref": "#/$defs/BoundingBox",
|
|
@@ -28,16 +28,20 @@
|
|
|
28
28
|
"title": "BoundingBox",
|
|
29
29
|
"properties": {
|
|
30
30
|
"xmin": {
|
|
31
|
-
"type": "integer"
|
|
31
|
+
"type": "integer",
|
|
32
|
+
"description": "The x-coordinate of the top-left corner of the bounding box."
|
|
32
33
|
},
|
|
33
34
|
"xmax": {
|
|
34
|
-
"type": "integer"
|
|
35
|
+
"type": "integer",
|
|
36
|
+
"description": "The x-coordinate of the bottom-right corner of the bounding box."
|
|
35
37
|
},
|
|
36
38
|
"ymin": {
|
|
37
|
-
"type": "integer"
|
|
39
|
+
"type": "integer",
|
|
40
|
+
"description": "The y-coordinate of the top-left corner of the bounding box."
|
|
38
41
|
},
|
|
39
42
|
"ymax": {
|
|
40
|
-
"type": "integer"
|
|
43
|
+
"type": "integer",
|
|
44
|
+
"description": "The y-coordinate of the bottom-right corner of the bounding box."
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
"required": ["xmin", "xmax", "ymin", "ymax"]
|
|
@@ -6,43 +6,44 @@
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Inputs for Summarization inference
|
|
9
|
-
*
|
|
10
|
-
* Inputs for Text2text Generation inference
|
|
11
9
|
*/
|
|
12
10
|
export interface SummarizationInput {
|
|
13
11
|
/**
|
|
14
|
-
* The input text
|
|
12
|
+
* The input text to summarize.
|
|
15
13
|
*/
|
|
16
14
|
inputs: string;
|
|
17
15
|
/**
|
|
18
|
-
* Additional inference parameters
|
|
16
|
+
* Additional inference parameters.
|
|
19
17
|
*/
|
|
20
|
-
parameters?:
|
|
18
|
+
parameters?: SummarizationParameters;
|
|
21
19
|
[property: string]: unknown;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
|
-
* Additional inference parameters
|
|
23
|
+
* Additional inference parameters.
|
|
26
24
|
*
|
|
27
|
-
* Additional inference parameters for
|
|
25
|
+
* Additional inference parameters for summarization.
|
|
28
26
|
*/
|
|
29
|
-
export interface
|
|
27
|
+
export interface SummarizationParameters {
|
|
30
28
|
/**
|
|
31
29
|
* Whether to clean up the potential extra spaces in the text output.
|
|
32
30
|
*/
|
|
33
31
|
clean_up_tokenization_spaces?: boolean;
|
|
34
32
|
/**
|
|
35
|
-
* Additional parametrization of the text generation algorithm
|
|
33
|
+
* Additional parametrization of the text generation algorithm.
|
|
36
34
|
*/
|
|
37
35
|
generate_parameters?: { [key: string]: unknown };
|
|
38
36
|
/**
|
|
39
|
-
* The truncation strategy to use
|
|
37
|
+
* The truncation strategy to use.
|
|
40
38
|
*/
|
|
41
|
-
truncation?:
|
|
39
|
+
truncation?: SummarizationTruncationStrategy;
|
|
42
40
|
[property: string]: unknown;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The truncation strategy to use.
|
|
45
|
+
*/
|
|
46
|
+
export type SummarizationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* Outputs of inference for the Summarization task
|
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$ref": "/inference/schemas/text2text-generation/input.json",
|
|
3
2
|
"$id": "/inference/schemas/summarization/input.json",
|
|
4
3
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
4
|
+
"description": "Inputs for Summarization inference",
|
|
5
5
|
"title": "SummarizationInput",
|
|
6
|
-
"
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"inputs": {
|
|
9
|
+
"description": "The input text to summarize.",
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"parameters": {
|
|
13
|
+
"description": "Additional inference parameters.",
|
|
14
|
+
"$ref": "#/$defs/SummarizationParameters"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"$defs": {
|
|
18
|
+
"SummarizationParameters": {
|
|
19
|
+
"title": "SummarizationParameters",
|
|
20
|
+
"description": "Additional inference parameters for summarization.",
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"clean_up_tokenization_spaces": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "Whether to clean up the potential extra spaces in the text output."
|
|
26
|
+
},
|
|
27
|
+
"truncation": {
|
|
28
|
+
"title": "SummarizationTruncationStrategy",
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "The truncation strategy to use.",
|
|
31
|
+
"enum": ["do_not_truncate", "longest_first", "only_first", "only_second"]
|
|
32
|
+
},
|
|
33
|
+
"generate_parameters": {
|
|
34
|
+
"title": "generateParameters",
|
|
35
|
+
"type": "object",
|
|
36
|
+
"description": "Additional parametrization of the text generation algorithm."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"required": ["inputs"]
|
|
7
42
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export interface TextToImageInput {
|
|
11
11
|
/**
|
|
12
|
-
* The input text data (sometimes called "prompt"
|
|
12
|
+
* The input text data (sometimes called "prompt")
|
|
13
13
|
*/
|
|
14
14
|
inputs: string;
|
|
15
15
|
/**
|
|
@@ -64,7 +64,7 @@ export interface TargetSize {
|
|
|
64
64
|
*/
|
|
65
65
|
export interface TextToImageOutput {
|
|
66
66
|
/**
|
|
67
|
-
* The generated image
|
|
67
|
+
* The generated image returned as raw bytes in the payload.
|
|
68
68
|
*/
|
|
69
69
|
image: unknown;
|
|
70
70
|
[property: string]: unknown;
|
|
@@ -6,43 +6,54 @@
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Inputs for Translation inference
|
|
9
|
-
*
|
|
10
|
-
* Inputs for Text2text Generation inference
|
|
11
9
|
*/
|
|
12
10
|
export interface TranslationInput {
|
|
13
11
|
/**
|
|
14
|
-
* The
|
|
12
|
+
* The text to translate.
|
|
15
13
|
*/
|
|
16
14
|
inputs: string;
|
|
17
15
|
/**
|
|
18
16
|
* Additional inference parameters
|
|
19
17
|
*/
|
|
20
|
-
parameters?:
|
|
18
|
+
parameters?: TranslationParameters;
|
|
21
19
|
[property: string]: unknown;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* Additional inference parameters
|
|
26
24
|
*
|
|
27
|
-
* Additional inference parameters for
|
|
25
|
+
* Additional inference parameters for Translation
|
|
28
26
|
*/
|
|
29
|
-
export interface
|
|
27
|
+
export interface TranslationParameters {
|
|
30
28
|
/**
|
|
31
29
|
* Whether to clean up the potential extra spaces in the text output.
|
|
32
30
|
*/
|
|
33
31
|
clean_up_tokenization_spaces?: boolean;
|
|
34
32
|
/**
|
|
35
|
-
* Additional parametrization of the text generation algorithm
|
|
33
|
+
* Additional parametrization of the text generation algorithm.
|
|
36
34
|
*/
|
|
37
35
|
generate_parameters?: { [key: string]: unknown };
|
|
38
36
|
/**
|
|
39
|
-
* The
|
|
37
|
+
* The source language of the text. Required for models that can translate from multiple
|
|
38
|
+
* languages.
|
|
39
|
+
*/
|
|
40
|
+
src_lang?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Target language to translate to. Required for models that can translate to multiple
|
|
43
|
+
* languages.
|
|
40
44
|
*/
|
|
41
|
-
|
|
45
|
+
tgt_lang?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The truncation strategy to use.
|
|
48
|
+
*/
|
|
49
|
+
truncation?: TranslationTruncationStrategy;
|
|
42
50
|
[property: string]: unknown;
|
|
43
51
|
}
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The truncation strategy to use.
|
|
55
|
+
*/
|
|
56
|
+
export type TranslationTruncationStrategy = "do_not_truncate" | "longest_first" | "only_first" | "only_second";
|
|
46
57
|
|
|
47
58
|
/**
|
|
48
59
|
* Outputs of inference for the Translation task
|
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$ref": "/inference/schemas/text2text-generation/input.json",
|
|
3
2
|
"$id": "/inference/schemas/translation/input.json",
|
|
4
3
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
|
4
|
+
"description": "Inputs for Translation inference",
|
|
5
5
|
"title": "TranslationInput",
|
|
6
|
-
"
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"inputs": {
|
|
9
|
+
"description": "The text to translate.",
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"parameters": {
|
|
13
|
+
"description": "Additional inference parameters",
|
|
14
|
+
"$ref": "#/$defs/TranslationParameters"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"$defs": {
|
|
18
|
+
"TranslationParameters": {
|
|
19
|
+
"title": "TranslationParameters",
|
|
20
|
+
"description": "Additional inference parameters for Translation",
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"src_lang": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "The source language of the text. Required for models that can translate from multiple languages."
|
|
26
|
+
},
|
|
27
|
+
"tgt_lang": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Target language to translate to. Required for models that can translate to multiple languages."
|
|
30
|
+
},
|
|
31
|
+
"clean_up_tokenization_spaces": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "Whether to clean up the potential extra spaces in the text output."
|
|
34
|
+
},
|
|
35
|
+
"truncation": {
|
|
36
|
+
"title": "TranslationTruncationStrategy",
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "The truncation strategy to use.",
|
|
39
|
+
"enum": ["do_not_truncate", "longest_first", "only_first", "only_second"]
|
|
40
|
+
},
|
|
41
|
+
"generate_parameters": {
|
|
42
|
+
"title": "generateParameters",
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "Additional parametrization of the text generation algorithm."
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["inputs"]
|
|
7
50
|
}
|