@huggingface/tasks 0.13.16 → 0.14.0
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/commonjs/model-data.d.ts +3 -0
- package/dist/commonjs/model-data.d.ts.map +1 -1
- package/dist/commonjs/model-libraries-snippets.d.ts +3 -1
- package/dist/commonjs/model-libraries-snippets.d.ts.map +1 -1
- package/dist/commonjs/model-libraries-snippets.js +134 -22
- package/dist/commonjs/model-libraries.d.ts +12 -8
- package/dist/commonjs/model-libraries.d.ts.map +1 -1
- package/dist/commonjs/model-libraries.js +15 -8
- package/dist/commonjs/tasks/audio-classification/inference.d.ts +1 -1
- package/dist/commonjs/tasks/audio-classification/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/automatic-speech-recognition/inference.d.ts +1 -1
- package/dist/commonjs/tasks/automatic-speech-recognition/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/automatic-speech-recognition/inference.js +0 -5
- package/dist/commonjs/tasks/chat-completion/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/chat-completion/inference.js +0 -5
- package/dist/commonjs/tasks/depth-estimation/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/depth-estimation/inference.js +0 -5
- package/dist/commonjs/tasks/feature-extraction/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/feature-extraction/inference.js +0 -5
- package/dist/commonjs/tasks/image-classification/inference.d.ts +1 -1
- package/dist/commonjs/tasks/image-classification/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-segmentation/inference.d.ts +1 -1
- package/dist/commonjs/tasks/image-segmentation/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-to-image/inference.d.ts +3 -3
- package/dist/commonjs/tasks/image-to-image/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-to-image/inference.js +0 -5
- package/dist/commonjs/tasks/image-to-text/inference.d.ts +1 -1
- package/dist/commonjs/tasks/image-to-text/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-to-text/inference.js +0 -5
- package/dist/commonjs/tasks/index.d.ts +1 -0
- package/dist/commonjs/tasks/index.d.ts.map +1 -1
- package/dist/commonjs/tasks/object-detection/inference.d.ts +1 -1
- package/dist/commonjs/tasks/object-detection/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/sentence-similarity/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/sentence-similarity/inference.js +0 -5
- package/dist/commonjs/tasks/summarization/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/summarization/inference.js +0 -5
- package/dist/commonjs/tasks/text-generation/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-generation/inference.js +0 -5
- package/dist/commonjs/tasks/text-to-audio/inference.d.ts +14 -15
- package/dist/commonjs/tasks/text-to-audio/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-to-audio/inference.js +0 -5
- package/dist/commonjs/tasks/text-to-image/inference.d.ts +2 -2
- package/dist/commonjs/tasks/text-to-image/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-to-image/inference.js +0 -5
- package/dist/commonjs/tasks/text-to-speech/inference.d.ts +14 -17
- package/dist/commonjs/tasks/text-to-speech/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-to-speech/inference.js +0 -5
- package/dist/commonjs/tasks/text-to-video/inference.d.ts +58 -0
- package/dist/commonjs/tasks/text-to-video/inference.d.ts.map +1 -0
- package/dist/commonjs/tasks/text-to-video/inference.js +2 -0
- package/dist/commonjs/tasks/text2text-generation/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/text2text-generation/inference.js +0 -5
- package/dist/commonjs/tasks/translation/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/translation/inference.js +0 -5
- package/dist/commonjs/tasks/visual-question-answering/inference.d.ts +1 -1
- package/dist/commonjs/tasks/visual-question-answering/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/zero-shot-image-classification/inference.d.ts +1 -1
- package/dist/commonjs/tasks/zero-shot-image-classification/inference.d.ts.map +1 -1
- package/dist/commonjs/tasks/zero-shot-object-detection/inference.d.ts +1 -1
- package/dist/commonjs/tasks/zero-shot-object-detection/inference.d.ts.map +1 -1
- package/dist/esm/model-data.d.ts +3 -0
- package/dist/esm/model-data.d.ts.map +1 -1
- package/dist/esm/model-libraries-snippets.d.ts +3 -1
- package/dist/esm/model-libraries-snippets.d.ts.map +1 -1
- package/dist/esm/model-libraries-snippets.js +129 -19
- package/dist/esm/model-libraries.d.ts +12 -8
- package/dist/esm/model-libraries.d.ts.map +1 -1
- package/dist/esm/model-libraries.js +15 -8
- package/dist/esm/tasks/audio-classification/inference.d.ts +1 -1
- package/dist/esm/tasks/audio-classification/inference.d.ts.map +1 -1
- package/dist/esm/tasks/automatic-speech-recognition/inference.d.ts +1 -1
- package/dist/esm/tasks/automatic-speech-recognition/inference.d.ts.map +1 -1
- package/dist/esm/tasks/automatic-speech-recognition/inference.js +0 -5
- package/dist/esm/tasks/chat-completion/inference.d.ts.map +1 -1
- package/dist/esm/tasks/chat-completion/inference.js +0 -5
- package/dist/esm/tasks/depth-estimation/inference.d.ts.map +1 -1
- package/dist/esm/tasks/depth-estimation/inference.js +0 -5
- package/dist/esm/tasks/feature-extraction/inference.d.ts.map +1 -1
- package/dist/esm/tasks/feature-extraction/inference.js +0 -5
- package/dist/esm/tasks/image-classification/inference.d.ts +1 -1
- package/dist/esm/tasks/image-classification/inference.d.ts.map +1 -1
- package/dist/esm/tasks/image-segmentation/inference.d.ts +1 -1
- package/dist/esm/tasks/image-segmentation/inference.d.ts.map +1 -1
- package/dist/esm/tasks/image-to-image/inference.d.ts +3 -3
- package/dist/esm/tasks/image-to-image/inference.d.ts.map +1 -1
- package/dist/esm/tasks/image-to-image/inference.js +0 -5
- package/dist/esm/tasks/image-to-text/inference.d.ts +1 -1
- package/dist/esm/tasks/image-to-text/inference.d.ts.map +1 -1
- package/dist/esm/tasks/image-to-text/inference.js +0 -5
- package/dist/esm/tasks/index.d.ts +1 -0
- package/dist/esm/tasks/index.d.ts.map +1 -1
- package/dist/esm/tasks/object-detection/inference.d.ts +1 -1
- package/dist/esm/tasks/object-detection/inference.d.ts.map +1 -1
- package/dist/esm/tasks/sentence-similarity/inference.d.ts.map +1 -1
- package/dist/esm/tasks/sentence-similarity/inference.js +0 -5
- package/dist/esm/tasks/summarization/inference.d.ts.map +1 -1
- package/dist/esm/tasks/summarization/inference.js +0 -5
- package/dist/esm/tasks/text-generation/inference.d.ts.map +1 -1
- package/dist/esm/tasks/text-generation/inference.js +0 -5
- package/dist/esm/tasks/text-to-audio/inference.d.ts +14 -15
- package/dist/esm/tasks/text-to-audio/inference.d.ts.map +1 -1
- package/dist/esm/tasks/text-to-audio/inference.js +0 -5
- package/dist/esm/tasks/text-to-image/inference.d.ts +2 -2
- package/dist/esm/tasks/text-to-image/inference.d.ts.map +1 -1
- package/dist/esm/tasks/text-to-image/inference.js +0 -5
- package/dist/esm/tasks/text-to-speech/inference.d.ts +14 -17
- package/dist/esm/tasks/text-to-speech/inference.d.ts.map +1 -1
- package/dist/esm/tasks/text-to-speech/inference.js +0 -5
- package/dist/esm/tasks/text-to-video/inference.d.ts +58 -0
- package/dist/esm/tasks/text-to-video/inference.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-video/inference.js +1 -0
- package/dist/esm/tasks/text2text-generation/inference.d.ts.map +1 -1
- package/dist/esm/tasks/text2text-generation/inference.js +0 -5
- package/dist/esm/tasks/translation/inference.d.ts.map +1 -1
- package/dist/esm/tasks/translation/inference.js +0 -5
- package/dist/esm/tasks/visual-question-answering/inference.d.ts +1 -1
- package/dist/esm/tasks/visual-question-answering/inference.d.ts.map +1 -1
- package/dist/esm/tasks/zero-shot-image-classification/inference.d.ts +1 -1
- package/dist/esm/tasks/zero-shot-image-classification/inference.d.ts.map +1 -1
- package/dist/esm/tasks/zero-shot-object-detection/inference.d.ts +1 -1
- package/dist/esm/tasks/zero-shot-object-detection/inference.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/model-data.ts +3 -0
- package/src/model-libraries-snippets.ts +141 -19
- package/src/model-libraries.ts +15 -8
- package/src/tasks/audio-classification/inference.ts +1 -1
- package/src/tasks/audio-classification/spec/input.json +2 -1
- package/src/tasks/automatic-speech-recognition/inference.ts +1 -7
- package/src/tasks/automatic-speech-recognition/spec/input.json +2 -1
- package/src/tasks/chat-completion/inference.ts +0 -33
- package/src/tasks/depth-estimation/inference.ts +3 -3
- package/src/tasks/document-question-answering/spec/input.json +2 -1
- package/src/tasks/feature-extraction/inference.ts +0 -3
- package/src/tasks/image-classification/inference.ts +1 -1
- package/src/tasks/image-classification/spec/input.json +2 -1
- package/src/tasks/image-segmentation/inference.ts +1 -1
- package/src/tasks/image-segmentation/spec/input.json +2 -1
- package/src/tasks/image-to-image/inference.ts +3 -7
- package/src/tasks/image-to-image/spec/input.json +4 -6
- package/src/tasks/image-to-text/inference.ts +1 -6
- package/src/tasks/image-to-text/spec/input.json +2 -1
- package/src/tasks/index.ts +1 -0
- package/src/tasks/object-detection/inference.ts +1 -1
- package/src/tasks/object-detection/spec/input.json +2 -1
- package/src/tasks/sentence-similarity/inference.ts +3 -4
- package/src/tasks/summarization/inference.ts +3 -5
- package/src/tasks/text-generation/inference.ts +0 -13
- package/src/tasks/text-to-audio/inference.ts +14 -20
- package/src/tasks/text-to-audio/spec/output.json +3 -2
- package/src/tasks/text-to-image/inference.ts +2 -6
- package/src/tasks/text-to-image/spec/input.json +2 -5
- package/src/tasks/text-to-speech/inference.ts +14 -22
- package/src/tasks/text-to-speech/spec/output.json +13 -2
- package/src/tasks/text-to-video/inference.ts +57 -0
- package/src/tasks/text-to-video/spec/input.json +49 -0
- package/src/tasks/text-to-video/spec/output.json +13 -0
- package/src/tasks/text2text-generation/inference.ts +3 -5
- package/src/tasks/translation/inference.ts +3 -5
- package/src/tasks/visual-question-answering/inference.ts +1 -1
- package/src/tasks/visual-question-answering/spec/input.json +4 -2
- package/src/tasks/zero-shot-image-classification/inference.ts +1 -1
- package/src/tasks/zero-shot-image-classification/spec/input.json +2 -1
- package/src/tasks/zero-shot-object-detection/inference.ts +1 -1
- package/src/tasks/zero-shot-object-detection/spec/input.json +2 -1
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outputs of inference for the Text To Audio task
|
|
3
|
+
*/
|
|
4
|
+
export interface TextToAudioOutput {
|
|
5
|
+
/**
|
|
6
|
+
* The generated audio waveform.
|
|
7
|
+
*/
|
|
8
|
+
audio: Blob;
|
|
9
|
+
/**
|
|
10
|
+
* The sampling rate of the generated audio waveform.
|
|
11
|
+
*/
|
|
12
|
+
sampling_rate: number;
|
|
13
|
+
[property: string]: unknown;
|
|
14
|
+
}
|
|
1
15
|
/**
|
|
2
16
|
* Inference code generated from the JSON schema spec in ./spec
|
|
3
17
|
*
|
|
@@ -117,19 +131,4 @@ export interface GenerationParameters {
|
|
|
117
131
|
* Controls the stopping condition for beam-based methods.
|
|
118
132
|
*/
|
|
119
133
|
export type EarlyStoppingUnion = boolean | "never";
|
|
120
|
-
/**
|
|
121
|
-
* Outputs of inference for the Text To Audio task
|
|
122
|
-
*/
|
|
123
|
-
export interface TextToAudioOutput {
|
|
124
|
-
/**
|
|
125
|
-
* The generated audio waveform.
|
|
126
|
-
*/
|
|
127
|
-
audio: unknown;
|
|
128
|
-
samplingRate: unknown;
|
|
129
|
-
/**
|
|
130
|
-
* The sampling rate of the generated audio waveform.
|
|
131
|
-
*/
|
|
132
|
-
sampling_rate?: number;
|
|
133
|
-
[property: string]: unknown;
|
|
134
|
-
}
|
|
135
134
|
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-audio/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-audio/inference.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,KAAK,EAAE,IAAI,CAAC;IACZ;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,qBAAqB,CAAC,EAAE,oBAAoB,CAAC;IAC7C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -27,9 +27,9 @@ export interface TextToImageParameters {
|
|
|
27
27
|
*/
|
|
28
28
|
guidance_scale?: number;
|
|
29
29
|
/**
|
|
30
|
-
* One
|
|
30
|
+
* One prompt to guide what NOT to include in image generation.
|
|
31
31
|
*/
|
|
32
|
-
negative_prompt?: string
|
|
32
|
+
negative_prompt?: string;
|
|
33
33
|
/**
|
|
34
34
|
* The number of denoising steps. More denoising steps usually lead to a higher quality
|
|
35
35
|
* image at the expense of slower inference.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-image/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-image/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outputs of inference for the Text To Speech task
|
|
3
|
+
*/
|
|
4
|
+
export interface TextToSpeechOutput {
|
|
5
|
+
/**
|
|
6
|
+
* The generated audio
|
|
7
|
+
*/
|
|
8
|
+
audio: Blob;
|
|
9
|
+
/**
|
|
10
|
+
* The sampling rate of the generated audio waveform.
|
|
11
|
+
*/
|
|
12
|
+
sampling_rate?: number;
|
|
13
|
+
[property: string]: unknown;
|
|
14
|
+
}
|
|
1
15
|
/**
|
|
2
16
|
* Inference code generated from the JSON schema spec in ./spec
|
|
3
17
|
*
|
|
@@ -117,21 +131,4 @@ export interface GenerationParameters {
|
|
|
117
131
|
* Controls the stopping condition for beam-based methods.
|
|
118
132
|
*/
|
|
119
133
|
export type EarlyStoppingUnion = boolean | "never";
|
|
120
|
-
/**
|
|
121
|
-
* Outputs for Text to Speech inference
|
|
122
|
-
*
|
|
123
|
-
* Outputs of inference for the Text To Audio task
|
|
124
|
-
*/
|
|
125
|
-
export interface TextToSpeechOutput {
|
|
126
|
-
/**
|
|
127
|
-
* The generated audio waveform.
|
|
128
|
-
*/
|
|
129
|
-
audio: unknown;
|
|
130
|
-
samplingRate: unknown;
|
|
131
|
-
/**
|
|
132
|
-
* The sampling rate of the generated audio waveform.
|
|
133
|
-
*/
|
|
134
|
-
sampling_rate?: number;
|
|
135
|
-
[property: string]: unknown;
|
|
136
|
-
}
|
|
137
134
|
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-speech/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-speech/inference.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,KAAK,EAAE,IAAI,CAAC;IACZ;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,qBAAqB,CAAC,EAAE,oBAAoB,CAAC;IAC7C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inference code generated from the JSON schema spec in ./spec
|
|
3
|
+
*
|
|
4
|
+
* Using src/scripts/inference-codegen
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Inputs for Text To Video inference
|
|
8
|
+
*/
|
|
9
|
+
export interface TextToVideoInput {
|
|
10
|
+
/**
|
|
11
|
+
* The input text data (sometimes called "prompt")
|
|
12
|
+
*/
|
|
13
|
+
inputs: string;
|
|
14
|
+
/**
|
|
15
|
+
* Additional inference parameters for Text To Video
|
|
16
|
+
*/
|
|
17
|
+
parameters?: TextToVideoParameters;
|
|
18
|
+
[property: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Additional inference parameters for Text To Video
|
|
22
|
+
*/
|
|
23
|
+
export interface TextToVideoParameters {
|
|
24
|
+
/**
|
|
25
|
+
* A higher guidance scale value encourages the model to generate images closely linked to
|
|
26
|
+
* the text prompt, but values too high may cause saturation and other artifacts.
|
|
27
|
+
*/
|
|
28
|
+
guidance_scale?: number;
|
|
29
|
+
/**
|
|
30
|
+
* One or several prompt to guide what NOT to include in image generation.
|
|
31
|
+
*/
|
|
32
|
+
negative_prompt?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* The num_frames parameter determines how many video frames are generated.
|
|
35
|
+
*/
|
|
36
|
+
num_frames?: number;
|
|
37
|
+
/**
|
|
38
|
+
* The number of denoising steps. More denoising steps usually lead to a higher quality
|
|
39
|
+
* image at the expense of slower inference.
|
|
40
|
+
*/
|
|
41
|
+
num_inference_steps?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Seed for the random number generator.
|
|
44
|
+
*/
|
|
45
|
+
seed?: number;
|
|
46
|
+
[property: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Outputs of inference for the Text To Video task
|
|
50
|
+
*/
|
|
51
|
+
export interface TextToVideoOutput {
|
|
52
|
+
/**
|
|
53
|
+
* The generated video returned as raw bytes in the payload.
|
|
54
|
+
*/
|
|
55
|
+
video: unknown;
|
|
56
|
+
[property: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text-to-video/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text2text-generation/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/text2text-generation/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,6BAA6B,CAAC;IAC3C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC7C;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,mBAAmB,CAAC,EAAE;QACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB,CAAC;IACF;;OAEG;IACH,UAAU,CAAC,EAAE,qCAAqC,CAAC;IACnD,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD,MAAM,MAAM,qCAAqC,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC;AACvH;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,aAAa,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/translation/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/translation/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,mBAAmB,CAAC,EAAE;QACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB,CAAC;IACF;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,6BAA6B,CAAC;IAC3C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC;AAC/G;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/visual-question-answering/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,MAAM,EAAE,gCAAgC,CAAC;IACzC;;OAEG;IACH,UAAU,CAAC,EAAE,iCAAiC,CAAC;IAC/C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/visual-question-answering/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,MAAM,EAAE,gCAAgC,CAAC;IACzC;;OAEG;IACH,UAAU,CAAC,EAAE,iCAAiC,CAAC;IAC/C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,iCAAiC;IACjD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD,MAAM,MAAM,6BAA6B,GAAG,oCAAoC,EAAE,CAAC;AACnF;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/zero-shot-image-classification/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/zero-shot-image-classification/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAChD;;OAEG;IACH,MAAM,EAAE,IAAI,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,qCAAqC,CAAC;IAClD,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACrD;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD,MAAM,MAAM,iCAAiC,GAAG,wCAAwC,EAAE,CAAC;AAC3F;;GAEG;AACH,MAAM,WAAW,wCAAwC;IACxD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/zero-shot-object-detection/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../../src/tasks/zero-shot-object-detection/inference.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;OAEG;IACH,MAAM,EAAE,IAAI,CAAC;IACb;;OAEG;IACH,UAAU,EAAE,iCAAiC,CAAC;IAC9C,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;GAEG;AACH,MAAM,WAAW,iCAAiC;IACjD;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AACD,MAAM,MAAM,6BAA6B,GAAG,oCAAoC,EAAE,CAAC;AACnF;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACpD;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huggingface/tasks",
|
|
3
3
|
"packageManager": "pnpm@8.10.5",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.0",
|
|
5
5
|
"description": "List of ML tasks for huggingface.co/tasks",
|
|
6
6
|
"repository": "https://github.com/huggingface/huggingface.js.git",
|
|
7
7
|
"publishConfig": {
|
package/src/model-data.ts
CHANGED
|
@@ -95,6 +95,29 @@ export const bm25s = (model: ModelData): string[] => [
|
|
|
95
95
|
retriever = BM25HF.load_from_hub("${model.id}")`,
|
|
96
96
|
];
|
|
97
97
|
|
|
98
|
+
export const cxr_foundation = (): string[] => [
|
|
99
|
+
`!git clone https://github.com/Google-Health/cxr-foundation.git
|
|
100
|
+
import tensorflow as tf, sys, requests
|
|
101
|
+
sys.path.append('cxr-foundation/python/')
|
|
102
|
+
|
|
103
|
+
# Install dependencies
|
|
104
|
+
major_version = tf.__version__.rsplit(".", 1)[0]
|
|
105
|
+
!pip install tensorflow-text=={major_version} pypng && pip install --no-deps pydicom hcls_imaging_ml_toolkit retrying
|
|
106
|
+
|
|
107
|
+
# Load image (Stillwaterising, CC0, via Wikimedia Commons)
|
|
108
|
+
from PIL import Image
|
|
109
|
+
from io import BytesIO
|
|
110
|
+
image_url = "https://upload.wikimedia.org/wikipedia/commons/c/c8/Chest_Xray_PA_3-8-2010.png"
|
|
111
|
+
response = requests.get(image_url, headers={'User-Agent': 'Demo'}, stream=True)
|
|
112
|
+
response.raw.decode_content = True # Ensure correct decoding
|
|
113
|
+
img = Image.open(BytesIO(response.content)).convert('L') # Convert to grayscale
|
|
114
|
+
|
|
115
|
+
# Run inference
|
|
116
|
+
from clientside.clients import make_hugging_face_client
|
|
117
|
+
cxr_client = make_hugging_face_client('cxr_model')
|
|
118
|
+
print(cxr_client.get_image_embeddings_from_images([img]))`,
|
|
119
|
+
];
|
|
120
|
+
|
|
98
121
|
export const depth_anything_v2 = (model: ModelData): string[] => {
|
|
99
122
|
let encoder: string;
|
|
100
123
|
let features: string;
|
|
@@ -168,6 +191,28 @@ focallength_px = prediction["focallength_px"]`;
|
|
|
168
191
|
return [installSnippet, inferenceSnippet];
|
|
169
192
|
};
|
|
170
193
|
|
|
194
|
+
export const derm_foundation = (): string[] => [
|
|
195
|
+
`from huggingface_hub import from_pretrained_keras
|
|
196
|
+
import tensorflow as tf, requests
|
|
197
|
+
|
|
198
|
+
# Load and format input
|
|
199
|
+
IMAGE_URL = "https://storage.googleapis.com/dx-scin-public-data/dataset/images/3445096909671059178.png"
|
|
200
|
+
input_tensor = tf.train.Example(
|
|
201
|
+
features=tf.train.Features(
|
|
202
|
+
feature={
|
|
203
|
+
"image/encoded": tf.train.Feature(
|
|
204
|
+
bytes_list=tf.train.BytesList(value=[requests.get(IMAGE_URL, stream=True).content])
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
).SerializeToString()
|
|
209
|
+
|
|
210
|
+
# Load model and run inference
|
|
211
|
+
loaded_model = from_pretrained_keras("google/derm-foundation")
|
|
212
|
+
infer = loaded_model.signatures["serving_default"]
|
|
213
|
+
print(infer(inputs=tf.constant([input_tensor])))`,
|
|
214
|
+
];
|
|
215
|
+
|
|
171
216
|
const diffusersDefaultPrompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k";
|
|
172
217
|
|
|
173
218
|
const diffusers_default = (model: ModelData) => [
|
|
@@ -394,32 +439,103 @@ model = keras.saving.load_model("hf://${model.id}")
|
|
|
394
439
|
`,
|
|
395
440
|
];
|
|
396
441
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
import os
|
|
400
|
-
os.environ["KERAS_BACKEND"] = "jax"
|
|
442
|
+
const _keras_hub_causal_lm = (modelId: string): string => `
|
|
443
|
+
import keras_hub
|
|
401
444
|
|
|
402
|
-
|
|
445
|
+
# Load CausalLM model (optional: use half precision for inference)
|
|
446
|
+
causal_lm = keras_hub.models.CausalLM.from_preset(${modelId}, dtype="bfloat16")
|
|
447
|
+
causal_lm.compile(sampler="greedy") # (optional) specify a sampler
|
|
403
448
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
];
|
|
449
|
+
# Generate text
|
|
450
|
+
causal_lm.generate("Keras: deep learning for", max_length=64)
|
|
451
|
+
`;
|
|
408
452
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
import os
|
|
412
|
-
os.environ["KERAS_BACKEND"] = "jax"
|
|
453
|
+
const _keras_hub_text_to_image = (modelId: string): string => `
|
|
454
|
+
import keras_hub
|
|
413
455
|
|
|
456
|
+
# Load TextToImage model (optional: use half precision for inference)
|
|
457
|
+
text_to_image = keras_hub.models.TextToImage.from_preset(${modelId}, dtype="bfloat16")
|
|
458
|
+
|
|
459
|
+
# Generate images with a TextToImage model.
|
|
460
|
+
text_to_image.generate("Astronaut in a jungle")
|
|
461
|
+
`;
|
|
462
|
+
|
|
463
|
+
const _keras_hub_text_classifier = (modelId: string): string => `
|
|
414
464
|
import keras_hub
|
|
415
465
|
|
|
416
|
-
# Load
|
|
417
|
-
|
|
466
|
+
# Load TextClassifier model
|
|
467
|
+
text_classifier = keras_hub.models.TextClassifier.from_preset(
|
|
468
|
+
${modelId},
|
|
469
|
+
num_classes=2,
|
|
470
|
+
)
|
|
471
|
+
# Fine-tune
|
|
472
|
+
text_classifier.fit(x=["Thilling adventure!", "Total snoozefest."], y=[1, 0])
|
|
473
|
+
# Classify text
|
|
474
|
+
text_classifier.predict(["Not my cup of tea."])
|
|
475
|
+
`;
|
|
418
476
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
477
|
+
const _keras_hub_image_classifier = (modelId: string): string => `
|
|
478
|
+
import keras_hub
|
|
479
|
+
import keras
|
|
480
|
+
|
|
481
|
+
# Load ImageClassifier model
|
|
482
|
+
image_classifier = keras_hub.models.ImageClassifier.from_preset(
|
|
483
|
+
${modelId},
|
|
484
|
+
num_classes=2,
|
|
485
|
+
)
|
|
486
|
+
# Fine-tune
|
|
487
|
+
image_classifier.fit(
|
|
488
|
+
x=keras.random.randint((32, 64, 64, 3), 0, 256),
|
|
489
|
+
y=keras.random.randint((32, 1), 0, 2),
|
|
490
|
+
)
|
|
491
|
+
# Classify image
|
|
492
|
+
image_classifier.predict(keras.random.randint((1, 64, 64, 3), 0, 256))
|
|
493
|
+
`;
|
|
494
|
+
|
|
495
|
+
const _keras_hub_tasks_with_example = {
|
|
496
|
+
CausalLM: _keras_hub_causal_lm,
|
|
497
|
+
TextToImage: _keras_hub_text_to_image,
|
|
498
|
+
TextClassifier: _keras_hub_text_classifier,
|
|
499
|
+
ImageClassifier: _keras_hub_image_classifier,
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const _keras_hub_task_without_example = (task: string, modelId: string): string => `
|
|
503
|
+
import keras_hub
|
|
504
|
+
|
|
505
|
+
# Create a ${task} model
|
|
506
|
+
task = keras_hub.models.${task}.from_preset(${modelId})
|
|
507
|
+
`;
|
|
508
|
+
|
|
509
|
+
const _keras_hub_generic_backbone = (modelId: string): string => `
|
|
510
|
+
import keras_hub
|
|
511
|
+
|
|
512
|
+
# Create a Backbone model unspecialized for any task
|
|
513
|
+
backbone = keras_hub.models.Backbone.from_preset(${modelId})
|
|
514
|
+
`;
|
|
515
|
+
|
|
516
|
+
export const keras_hub = (model: ModelData): string[] => {
|
|
517
|
+
const modelId = model.id;
|
|
518
|
+
const tasks = model.config?.keras_hub?.tasks ?? [];
|
|
519
|
+
|
|
520
|
+
const snippets: string[] = [];
|
|
521
|
+
|
|
522
|
+
// First, generate tasks with examples
|
|
523
|
+
for (const [task, snippet] of Object.entries(_keras_hub_tasks_with_example)) {
|
|
524
|
+
if (tasks.includes(task)) {
|
|
525
|
+
snippets.push(snippet(modelId));
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
// Then, add remaining tasks
|
|
529
|
+
for (const task in tasks) {
|
|
530
|
+
if (!Object.keys(_keras_hub_tasks_with_example).includes(task)) {
|
|
531
|
+
snippets.push(_keras_hub_task_without_example(task, modelId));
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
// Finally, add generic backbone snippet
|
|
535
|
+
snippets.push(_keras_hub_generic_backbone(modelId));
|
|
536
|
+
|
|
537
|
+
return snippets;
|
|
538
|
+
};
|
|
423
539
|
|
|
424
540
|
export const llama_cpp_python = (model: ModelData): string[] => {
|
|
425
541
|
const snippets = [
|
|
@@ -845,6 +961,12 @@ model.${speechbrainMethod}("file.wav")`,
|
|
|
845
961
|
];
|
|
846
962
|
};
|
|
847
963
|
|
|
964
|
+
export const terratorch = (model: ModelData): string[] => [
|
|
965
|
+
`from terratorch.registry import BACKBONE_REGISTRY
|
|
966
|
+
|
|
967
|
+
model = BACKBONE_REGISTRY.build("${model.id}")`,
|
|
968
|
+
];
|
|
969
|
+
|
|
848
970
|
export const transformers = (model: ModelData): string[] => {
|
|
849
971
|
const info = model.transformersInfo;
|
|
850
972
|
if (!info) {
|
package/src/model-libraries.ts
CHANGED
|
@@ -176,6 +176,7 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
176
176
|
prettyLabel: "CXR Foundation",
|
|
177
177
|
repoName: "cxr-foundation",
|
|
178
178
|
repoUrl: "https://github.com/google-health/cxr-foundation",
|
|
179
|
+
snippets: snippets.cxr_foundation,
|
|
179
180
|
filter: false,
|
|
180
181
|
countDownloads: `path:"precomputed_embeddings/embeddings.npz" OR path:"pax-elixr-b-text/saved_model.pb"`,
|
|
181
182
|
},
|
|
@@ -206,6 +207,7 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
206
207
|
prettyLabel: "Derm Foundation",
|
|
207
208
|
repoName: "derm-foundation",
|
|
208
209
|
repoUrl: "https://github.com/google-health/derm-foundation",
|
|
210
|
+
snippets: snippets.derm_foundation,
|
|
209
211
|
filter: false,
|
|
210
212
|
countDownloads: `path:"scin_dataset_precomputed_embeddings.npz" OR path:"saved_model.pb"`,
|
|
211
213
|
},
|
|
@@ -404,13 +406,6 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
404
406
|
snippets: snippets.tf_keras,
|
|
405
407
|
countDownloads: `path:"saved_model.pb"`,
|
|
406
408
|
},
|
|
407
|
-
"keras-nlp": {
|
|
408
|
-
prettyLabel: "KerasNLP",
|
|
409
|
-
repoName: "KerasNLP",
|
|
410
|
-
repoUrl: "https://github.com/keras-team/keras-nlp",
|
|
411
|
-
docsUrl: "https://keras.io/keras_nlp/",
|
|
412
|
-
snippets: snippets.keras_nlp,
|
|
413
|
-
},
|
|
414
409
|
"keras-hub": {
|
|
415
410
|
prettyLabel: "KerasHub",
|
|
416
411
|
repoName: "KerasHub",
|
|
@@ -544,7 +539,10 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
544
539
|
repoUrl: "https://github.com/mlfoundations/open_clip",
|
|
545
540
|
snippets: snippets.open_clip,
|
|
546
541
|
filter: true,
|
|
547
|
-
countDownloads: `
|
|
542
|
+
countDownloads: `path:"open_clip_model.safetensors"
|
|
543
|
+
OR path:"model.safetensors"
|
|
544
|
+
OR path:"open_clip_pytorch_model.bin"
|
|
545
|
+
OR path:"pytorch_model.bin"`,
|
|
548
546
|
},
|
|
549
547
|
paddlenlp: {
|
|
550
548
|
prettyLabel: "paddlenlp",
|
|
@@ -780,6 +778,15 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
780
778
|
repoName: "TabPFN",
|
|
781
779
|
repoUrl: "https://github.com/PriorLabs/TabPFN",
|
|
782
780
|
},
|
|
781
|
+
terratorch: {
|
|
782
|
+
prettyLabel: "TerraTorch",
|
|
783
|
+
repoName: "TerraTorch",
|
|
784
|
+
repoUrl: "https://github.com/IBM/terratorch",
|
|
785
|
+
docsUrl: "https://ibm.github.io/terratorch/",
|
|
786
|
+
filter: false,
|
|
787
|
+
countDownloads: `path_extension:"pt"`,
|
|
788
|
+
snippets: snippets.terratorch,
|
|
789
|
+
},
|
|
783
790
|
"tic-clip": {
|
|
784
791
|
prettyLabel: "TiC-CLIP",
|
|
785
792
|
repoName: "TiC-CLIP",
|
|
@@ -11,7 +11,7 @@ export interface AudioClassificationInput {
|
|
|
11
11
|
* The input audio data as a base64-encoded string. If no `parameters` are provided, you can
|
|
12
12
|
* also provide the audio data as a raw bytes payload.
|
|
13
13
|
*/
|
|
14
|
-
inputs:
|
|
14
|
+
inputs: Blob;
|
|
15
15
|
/**
|
|
16
16
|
* Additional inference parameters for Audio Classification
|
|
17
17
|
*/
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"properties": {
|
|
8
8
|
"inputs": {
|
|
9
9
|
"description": "The input audio data as a base64-encoded string. If no `parameters` are provided, you can also provide the audio data as a raw bytes payload.",
|
|
10
|
-
"type": "string"
|
|
10
|
+
"type": "string",
|
|
11
|
+
"comment": "type=binary"
|
|
11
12
|
},
|
|
12
13
|
"parameters": {
|
|
13
14
|
"description": "Additional inference parameters for Audio Classification",
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Using src/scripts/inference-codegen
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Inputs for Automatic Speech Recognition inference
|
|
9
8
|
*/
|
|
@@ -12,14 +11,13 @@ export interface AutomaticSpeechRecognitionInput {
|
|
|
12
11
|
* The input audio data as a base64-encoded string. If no `parameters` are provided, you can
|
|
13
12
|
* also provide the audio data as a raw bytes payload.
|
|
14
13
|
*/
|
|
15
|
-
inputs:
|
|
14
|
+
inputs: Blob;
|
|
16
15
|
/**
|
|
17
16
|
* Additional inference parameters for Automatic Speech Recognition
|
|
18
17
|
*/
|
|
19
18
|
parameters?: AutomaticSpeechRecognitionParameters;
|
|
20
19
|
[property: string]: unknown;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
/**
|
|
24
22
|
* Additional inference parameters for Automatic Speech Recognition
|
|
25
23
|
*/
|
|
@@ -34,7 +32,6 @@ export interface AutomaticSpeechRecognitionParameters {
|
|
|
34
32
|
return_timestamps?: boolean;
|
|
35
33
|
[property: string]: unknown;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
/**
|
|
39
36
|
* Parametrization of the text generation process
|
|
40
37
|
*/
|
|
@@ -121,12 +118,10 @@ export interface GenerationParameters {
|
|
|
121
118
|
use_cache?: boolean;
|
|
122
119
|
[property: string]: unknown;
|
|
123
120
|
}
|
|
124
|
-
|
|
125
121
|
/**
|
|
126
122
|
* Controls the stopping condition for beam-based methods.
|
|
127
123
|
*/
|
|
128
124
|
export type EarlyStoppingUnion = boolean | "never";
|
|
129
|
-
|
|
130
125
|
/**
|
|
131
126
|
* Outputs of inference for the Automatic Speech Recognition task
|
|
132
127
|
*/
|
|
@@ -142,7 +137,6 @@ export interface AutomaticSpeechRecognitionOutput {
|
|
|
142
137
|
text: string;
|
|
143
138
|
[property: string]: unknown;
|
|
144
139
|
}
|
|
145
|
-
|
|
146
140
|
export interface AutomaticSpeechRecognitionOutputChunk {
|
|
147
141
|
/**
|
|
148
142
|
* A chunk of text identified by the model
|