@huggingface/tasks 0.13.1 → 0.13.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/commonjs/dataset-libraries.js +65 -0
- package/dist/{src → commonjs}/default-widget-inputs.d.ts +2 -2
- package/dist/commonjs/default-widget-inputs.d.ts.map +1 -0
- package/dist/commonjs/default-widget-inputs.js +698 -0
- package/dist/commonjs/gguf.js +43 -0
- package/dist/commonjs/hardware.js +461 -0
- package/dist/{src → commonjs}/index.d.ts +19 -19
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +57 -0
- package/dist/{src → commonjs}/library-to-tasks.d.ts +2 -2
- package/dist/commonjs/library-to-tasks.d.ts.map +1 -0
- package/dist/commonjs/library-to-tasks.js +76 -0
- package/dist/{src → commonjs}/local-apps.d.ts +2 -2
- package/dist/commonjs/local-apps.d.ts.map +1 -0
- package/dist/commonjs/local-apps.js +334 -0
- package/dist/{src → commonjs}/model-data.d.ts +3 -3
- package/dist/commonjs/model-data.d.ts.map +1 -0
- package/dist/commonjs/model-data.js +2 -0
- package/dist/commonjs/model-libraries-downloads.js +18 -0
- package/dist/{src → commonjs}/model-libraries-snippets.d.ts +1 -1
- package/dist/commonjs/model-libraries-snippets.d.ts.map +1 -0
- package/dist/commonjs/model-libraries-snippets.js +1093 -0
- package/dist/{src → commonjs}/model-libraries.d.ts +3 -3
- package/dist/{src → commonjs}/model-libraries.d.ts.map +1 -1
- package/dist/commonjs/model-libraries.js +793 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/{src → commonjs}/pipelines.d.ts +1 -1
- package/dist/{src → commonjs}/pipelines.d.ts.map +1 -1
- package/dist/commonjs/pipelines.js +645 -0
- package/dist/{src → commonjs}/snippets/common.d.ts +1 -1
- package/dist/commonjs/snippets/common.d.ts.map +1 -0
- package/dist/commonjs/snippets/common.js +23 -0
- package/dist/commonjs/snippets/curl.js +100 -0
- package/dist/commonjs/snippets/curl.spec.js +89 -0
- package/dist/commonjs/snippets/index.d.ts +7 -0
- package/dist/commonjs/snippets/index.d.ts.map +1 -0
- package/dist/commonjs/snippets/index.js +38 -0
- package/dist/commonjs/snippets/inputs.d.ts +4 -0
- package/dist/commonjs/snippets/inputs.d.ts.map +1 -0
- package/dist/commonjs/snippets/inputs.js +127 -0
- package/dist/commonjs/snippets/js.js +278 -0
- package/dist/commonjs/snippets/js.spec.js +141 -0
- package/dist/{src → commonjs}/snippets/python.d.ts +1 -1
- package/dist/{src → commonjs}/snippets/python.d.ts.map +1 -1
- package/dist/commonjs/snippets/python.js +293 -0
- package/dist/commonjs/snippets/python.spec.js +135 -0
- package/dist/{src → commonjs}/snippets/types.d.ts +1 -1
- package/dist/commonjs/snippets/types.d.ts.map +1 -0
- package/dist/commonjs/snippets/types.js +2 -0
- package/dist/commonjs/tasks/audio-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/audio-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/audio-classification/data.js +79 -0
- package/dist/commonjs/tasks/audio-classification/inference.js +2 -0
- package/dist/commonjs/tasks/audio-to-audio/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/audio-to-audio/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/audio-to-audio/data.js +66 -0
- package/dist/commonjs/tasks/automatic-speech-recognition/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/automatic-speech-recognition/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/automatic-speech-recognition/data.js +80 -0
- package/dist/commonjs/tasks/automatic-speech-recognition/inference.js +7 -0
- package/dist/commonjs/tasks/chat-completion/inference.js +7 -0
- package/dist/commonjs/tasks/depth-estimation/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/depth-estimation/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/depth-estimation/data.js +69 -0
- package/dist/commonjs/tasks/depth-estimation/inference.js +7 -0
- package/dist/commonjs/tasks/document-question-answering/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/document-question-answering/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/document-question-answering/data.js +80 -0
- package/dist/commonjs/tasks/document-question-answering/inference.js +2 -0
- package/dist/commonjs/tasks/feature-extraction/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/feature-extraction/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/feature-extraction/data.js +55 -0
- package/dist/commonjs/tasks/feature-extraction/inference.js +7 -0
- package/dist/commonjs/tasks/fill-mask/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/fill-mask/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/fill-mask/data.js +75 -0
- package/dist/commonjs/tasks/fill-mask/inference.js +2 -0
- package/dist/commonjs/tasks/image-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/image-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-classification/data.js +86 -0
- package/dist/commonjs/tasks/image-classification/inference.js +2 -0
- package/dist/commonjs/tasks/image-feature-extraction/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/image-feature-extraction/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-feature-extraction/data.js +57 -0
- package/dist/commonjs/tasks/image-segmentation/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/image-segmentation/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-segmentation/data.js +95 -0
- package/dist/commonjs/tasks/image-segmentation/inference.js +2 -0
- package/dist/commonjs/tasks/image-text-to-text/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/image-text-to-text/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-text-to-text/data.js +99 -0
- package/dist/commonjs/tasks/image-to-3d/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/image-to-3d/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-to-3d/data.js +74 -0
- package/dist/commonjs/tasks/image-to-image/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/image-to-image/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-to-image/data.js +95 -0
- package/dist/commonjs/tasks/image-to-image/inference.js +7 -0
- package/dist/commonjs/tasks/image-to-text/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/image-to-text/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/image-to-text/data.js +80 -0
- package/dist/commonjs/tasks/image-to-text/inference.js +7 -0
- package/dist/{src → commonjs}/tasks/index.d.ts +29 -29
- package/dist/commonjs/tasks/index.d.ts.map +1 -0
- package/dist/commonjs/tasks/index.js +183 -0
- package/dist/commonjs/tasks/keypoint-detection/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/keypoint-detection/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/keypoint-detection/data.js +49 -0
- package/dist/commonjs/tasks/mask-generation/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/mask-generation/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/mask-generation/data.js +52 -0
- package/dist/commonjs/tasks/object-detection/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/object-detection/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/object-detection/data.js +82 -0
- package/dist/commonjs/tasks/object-detection/inference.js +2 -0
- package/dist/commonjs/tasks/placeholder/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/placeholder/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/placeholder/data.js +20 -0
- package/dist/commonjs/tasks/question-answering/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/question-answering/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/question-answering/data.js +71 -0
- package/dist/commonjs/tasks/question-answering/inference.js +2 -0
- package/dist/commonjs/tasks/reinforcement-learning/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/reinforcement-learning/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/reinforcement-learning/data.js +69 -0
- package/dist/commonjs/tasks/sentence-similarity/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/sentence-similarity/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/sentence-similarity/data.js +95 -0
- package/dist/commonjs/tasks/sentence-similarity/inference.js +7 -0
- package/dist/commonjs/tasks/summarization/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/summarization/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/summarization/data.js +69 -0
- package/dist/commonjs/tasks/summarization/inference.js +7 -0
- package/dist/commonjs/tasks/table-question-answering/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/table-question-answering/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/table-question-answering/data.js +54 -0
- package/dist/commonjs/tasks/table-question-answering/inference.js +2 -0
- package/dist/commonjs/tasks/tabular-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/tabular-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/tabular-classification/data.js +67 -0
- package/dist/commonjs/tasks/tabular-regression/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/tabular-regression/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/tabular-regression/data.js +55 -0
- package/dist/commonjs/tasks/text-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/text-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-classification/data.js +100 -0
- package/dist/commonjs/tasks/text-classification/inference.js +2 -0
- package/dist/commonjs/tasks/text-generation/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/text-generation/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-generation/data.js +108 -0
- package/dist/commonjs/tasks/text-generation/inference.js +7 -0
- package/dist/commonjs/tasks/text-to-3d/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/text-to-3d/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-to-3d/data.js +55 -0
- package/dist/commonjs/tasks/text-to-audio/inference.js +7 -0
- package/dist/commonjs/tasks/text-to-image/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/text-to-image/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-to-image/data.js +95 -0
- package/dist/commonjs/tasks/text-to-image/inference.js +7 -0
- package/dist/commonjs/tasks/text-to-speech/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/text-to-speech/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-to-speech/data.js +76 -0
- package/dist/commonjs/tasks/text-to-speech/inference.js +7 -0
- package/dist/commonjs/tasks/text-to-video/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/text-to-video/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/text-to-video/data.js +95 -0
- package/dist/commonjs/tasks/text2text-generation/inference.js +7 -0
- package/dist/commonjs/tasks/token-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/token-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/token-classification/data.js +87 -0
- package/dist/commonjs/tasks/token-classification/inference.js +2 -0
- package/dist/commonjs/tasks/translation/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/translation/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/translation/data.js +65 -0
- package/dist/commonjs/tasks/translation/inference.js +7 -0
- package/dist/commonjs/tasks/unconditional-image-generation/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/unconditional-image-generation/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/unconditional-image-generation/data.js +65 -0
- package/dist/commonjs/tasks/video-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/video-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/video-classification/data.js +82 -0
- package/dist/commonjs/tasks/video-classification/inference.js +2 -0
- package/dist/commonjs/tasks/video-text-to-text/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/video-text-to-text/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/video-text-to-text/data.js +63 -0
- package/dist/commonjs/tasks/visual-question-answering/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/visual-question-answering/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/visual-question-answering/data.js +93 -0
- package/dist/commonjs/tasks/visual-question-answering/inference.js +2 -0
- package/dist/commonjs/tasks/zero-shot-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/zero-shot-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/zero-shot-classification/data.js +66 -0
- package/dist/commonjs/tasks/zero-shot-classification/inference.js +2 -0
- package/dist/commonjs/tasks/zero-shot-image-classification/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/zero-shot-image-classification/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/zero-shot-image-classification/data.js +81 -0
- package/dist/commonjs/tasks/zero-shot-image-classification/inference.js +2 -0
- package/dist/commonjs/tasks/zero-shot-object-detection/data.d.ts +4 -0
- package/dist/{src → commonjs}/tasks/zero-shot-object-detection/data.d.ts.map +1 -1
- package/dist/commonjs/tasks/zero-shot-object-detection/data.js +62 -0
- package/dist/commonjs/tasks/zero-shot-object-detection/inference.js +2 -0
- package/dist/commonjs/tokenizer-data.js +13 -0
- package/dist/{src → commonjs}/widget-example.d.ts +1 -1
- package/dist/commonjs/widget-example.d.ts.map +1 -0
- package/dist/commonjs/widget-example.js +5 -0
- package/dist/esm/dataset-libraries.d.ts +87 -0
- package/dist/esm/dataset-libraries.d.ts.map +1 -0
- package/dist/esm/dataset-libraries.js +62 -0
- package/dist/esm/default-widget-inputs.d.ts +6 -0
- package/dist/esm/default-widget-inputs.d.ts.map +1 -0
- package/dist/esm/default-widget-inputs.js +695 -0
- package/dist/esm/gguf.d.ts +35 -0
- package/dist/esm/gguf.d.ts.map +1 -0
- package/dist/esm/gguf.js +39 -0
- package/dist/esm/hardware.d.ts +478 -0
- package/dist/esm/hardware.d.ts.map +1 -0
- package/dist/esm/hardware.js +458 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/library-to-tasks.d.ts +11 -0
- package/dist/esm/library-to-tasks.d.ts.map +1 -0
- package/dist/esm/library-to-tasks.js +73 -0
- package/dist/esm/local-apps.d.ts +195 -0
- package/dist/esm/local-apps.d.ts.map +1 -0
- package/dist/esm/local-apps.js +331 -0
- package/dist/esm/model-data.d.ts +146 -0
- package/dist/esm/model-data.d.ts.map +1 -0
- package/dist/esm/model-data.js +1 -0
- package/dist/esm/model-libraries-downloads.d.ts +18 -0
- package/dist/esm/model-libraries-downloads.d.ts.map +1 -0
- package/dist/esm/model-libraries-downloads.js +17 -0
- package/dist/esm/model-libraries-snippets.d.ts +72 -0
- package/dist/esm/model-libraries-snippets.d.ts.map +1 -0
- package/dist/esm/model-libraries-snippets.js +1019 -0
- package/dist/esm/model-libraries.d.ts +804 -0
- package/dist/esm/model-libraries.d.ts.map +1 -0
- package/dist/esm/model-libraries.js +767 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/pipelines.d.ts +425 -0
- package/dist/esm/pipelines.d.ts.map +1 -0
- package/dist/esm/pipelines.js +642 -0
- package/dist/esm/snippets/common.d.ts +14 -0
- package/dist/esm/snippets/common.d.ts.map +1 -0
- package/dist/esm/snippets/common.js +19 -0
- package/dist/esm/snippets/curl.d.ts +17 -0
- package/dist/esm/snippets/curl.d.ts.map +1 -0
- package/dist/esm/snippets/curl.js +91 -0
- package/dist/esm/snippets/curl.spec.d.ts +2 -0
- package/dist/esm/snippets/curl.spec.d.ts.map +1 -0
- package/dist/esm/snippets/curl.spec.js +87 -0
- package/dist/esm/snippets/index.d.ts +7 -0
- package/dist/esm/snippets/index.d.ts.map +1 -0
- package/dist/esm/snippets/index.js +6 -0
- package/dist/esm/snippets/inputs.d.ts +4 -0
- package/dist/esm/snippets/inputs.d.ts.map +1 -0
- package/dist/esm/snippets/inputs.js +124 -0
- package/dist/esm/snippets/js.d.ts +19 -0
- package/dist/esm/snippets/js.d.ts.map +1 -0
- package/dist/esm/snippets/js.js +267 -0
- package/dist/esm/snippets/js.spec.d.ts +2 -0
- package/dist/esm/snippets/js.spec.d.ts.map +1 -0
- package/dist/esm/snippets/js.spec.js +139 -0
- package/dist/esm/snippets/python.d.ts +22 -0
- package/dist/esm/snippets/python.d.ts.map +1 -0
- package/dist/esm/snippets/python.js +279 -0
- package/dist/esm/snippets/python.spec.d.ts +2 -0
- package/dist/esm/snippets/python.spec.d.ts.map +1 -0
- package/dist/esm/snippets/python.spec.js +133 -0
- package/dist/esm/snippets/types.d.ts +12 -0
- package/dist/esm/snippets/types.d.ts.map +1 -0
- package/dist/esm/snippets/types.js +1 -0
- package/dist/esm/tasks/audio-classification/data.d.ts +4 -0
- package/dist/esm/tasks/audio-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/audio-classification/data.js +77 -0
- package/dist/esm/tasks/audio-classification/inference.d.ts +53 -0
- package/dist/esm/tasks/audio-classification/inference.d.ts.map +1 -0
- package/dist/esm/tasks/audio-classification/inference.js +1 -0
- package/dist/esm/tasks/audio-to-audio/data.d.ts +4 -0
- package/dist/esm/tasks/audio-to-audio/data.d.ts.map +1 -0
- package/dist/esm/tasks/audio-to-audio/data.js +64 -0
- package/dist/esm/tasks/automatic-speech-recognition/data.d.ts +4 -0
- package/dist/esm/tasks/automatic-speech-recognition/data.d.ts.map +1 -0
- package/dist/esm/tasks/automatic-speech-recognition/data.js +78 -0
- package/dist/esm/tasks/automatic-speech-recognition/inference.d.ts +155 -0
- package/dist/esm/tasks/automatic-speech-recognition/inference.d.ts.map +1 -0
- package/dist/esm/tasks/automatic-speech-recognition/inference.js +6 -0
- package/dist/esm/tasks/chat-completion/inference.d.ts +291 -0
- package/dist/esm/tasks/chat-completion/inference.d.ts.map +1 -0
- package/dist/esm/tasks/chat-completion/inference.js +6 -0
- package/dist/esm/tasks/depth-estimation/data.d.ts +4 -0
- package/dist/esm/tasks/depth-estimation/data.d.ts.map +1 -0
- package/dist/esm/tasks/depth-estimation/data.js +67 -0
- package/dist/esm/tasks/depth-estimation/inference.d.ts +36 -0
- package/dist/esm/tasks/depth-estimation/inference.d.ts.map +1 -0
- package/dist/esm/tasks/depth-estimation/inference.js +6 -0
- package/dist/esm/tasks/document-question-answering/data.d.ts +4 -0
- package/dist/esm/tasks/document-question-answering/data.d.ts.map +1 -0
- package/dist/esm/tasks/document-question-answering/data.js +78 -0
- package/dist/esm/tasks/document-question-answering/inference.d.ts +111 -0
- package/dist/esm/tasks/document-question-answering/inference.d.ts.map +1 -0
- package/dist/esm/tasks/document-question-answering/inference.js +1 -0
- package/dist/esm/tasks/feature-extraction/data.d.ts +4 -0
- package/dist/esm/tasks/feature-extraction/data.d.ts.map +1 -0
- package/dist/esm/tasks/feature-extraction/data.js +53 -0
- package/dist/esm/tasks/feature-extraction/inference.d.ts +38 -0
- package/dist/esm/tasks/feature-extraction/inference.d.ts.map +1 -0
- package/dist/esm/tasks/feature-extraction/inference.js +6 -0
- package/dist/esm/tasks/fill-mask/data.d.ts +4 -0
- package/dist/esm/tasks/fill-mask/data.d.ts.map +1 -0
- package/dist/esm/tasks/fill-mask/data.js +73 -0
- package/dist/esm/tasks/fill-mask/inference.d.ts +63 -0
- package/dist/esm/tasks/fill-mask/inference.d.ts.map +1 -0
- package/dist/esm/tasks/fill-mask/inference.js +1 -0
- package/dist/esm/tasks/image-classification/data.d.ts +4 -0
- package/dist/esm/tasks/image-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/image-classification/data.js +84 -0
- package/dist/esm/tasks/image-classification/inference.d.ts +53 -0
- package/dist/esm/tasks/image-classification/inference.d.ts.map +1 -0
- package/dist/esm/tasks/image-classification/inference.js +1 -0
- package/dist/esm/tasks/image-feature-extraction/data.d.ts +4 -0
- package/dist/esm/tasks/image-feature-extraction/data.d.ts.map +1 -0
- package/dist/esm/tasks/image-feature-extraction/data.js +55 -0
- package/dist/esm/tasks/image-segmentation/data.d.ts +4 -0
- package/dist/esm/tasks/image-segmentation/data.d.ts.map +1 -0
- package/dist/esm/tasks/image-segmentation/data.js +93 -0
- package/dist/esm/tasks/image-segmentation/inference.d.ts +70 -0
- package/dist/esm/tasks/image-segmentation/inference.d.ts.map +1 -0
- package/dist/esm/tasks/image-segmentation/inference.js +1 -0
- package/dist/esm/tasks/image-text-to-text/data.d.ts +4 -0
- package/dist/esm/tasks/image-text-to-text/data.d.ts.map +1 -0
- package/dist/esm/tasks/image-text-to-text/data.js +97 -0
- package/dist/esm/tasks/image-to-3d/data.d.ts +4 -0
- package/dist/esm/tasks/image-to-3d/data.d.ts.map +1 -0
- package/dist/esm/tasks/image-to-3d/data.js +72 -0
- package/dist/esm/tasks/image-to-image/data.d.ts +4 -0
- package/dist/esm/tasks/image-to-image/data.d.ts.map +1 -0
- package/dist/esm/tasks/image-to-image/data.js +93 -0
- package/dist/esm/tasks/image-to-image/inference.d.ts +65 -0
- package/dist/esm/tasks/image-to-image/inference.d.ts.map +1 -0
- package/dist/esm/tasks/image-to-image/inference.js +6 -0
- package/dist/esm/tasks/image-to-text/data.d.ts +4 -0
- package/dist/esm/tasks/image-to-text/data.d.ts.map +1 -0
- package/dist/esm/tasks/image-to-text/data.js +78 -0
- package/dist/esm/tasks/image-to-text/inference.d.ts +139 -0
- package/dist/esm/tasks/image-to-text/inference.d.ts.map +1 -0
- package/dist/esm/tasks/image-to-text/inference.js +6 -0
- package/dist/esm/tasks/index.d.ts +87 -0
- package/dist/esm/tasks/index.d.ts.map +1 -0
- package/dist/esm/tasks/index.js +177 -0
- package/dist/esm/tasks/keypoint-detection/data.d.ts +4 -0
- package/dist/esm/tasks/keypoint-detection/data.d.ts.map +1 -0
- package/dist/esm/tasks/keypoint-detection/data.js +47 -0
- package/dist/esm/tasks/mask-generation/data.d.ts +4 -0
- package/dist/esm/tasks/mask-generation/data.d.ts.map +1 -0
- package/dist/esm/tasks/mask-generation/data.js +50 -0
- package/dist/esm/tasks/object-detection/data.d.ts +4 -0
- package/dist/esm/tasks/object-detection/data.d.ts.map +1 -0
- package/dist/esm/tasks/object-detection/data.js +80 -0
- package/dist/esm/tasks/object-detection/inference.d.ts +76 -0
- package/dist/esm/tasks/object-detection/inference.d.ts.map +1 -0
- package/dist/esm/tasks/object-detection/inference.js +1 -0
- package/dist/esm/tasks/placeholder/data.d.ts +4 -0
- package/dist/esm/tasks/placeholder/data.d.ts.map +1 -0
- package/dist/esm/tasks/placeholder/data.js +18 -0
- package/dist/esm/tasks/question-answering/data.d.ts +4 -0
- package/dist/esm/tasks/question-answering/data.d.ts.map +1 -0
- package/dist/esm/tasks/question-answering/data.js +69 -0
- package/dist/esm/tasks/question-answering/inference.d.ts +100 -0
- package/dist/esm/tasks/question-answering/inference.d.ts.map +1 -0
- package/dist/esm/tasks/question-answering/inference.js +1 -0
- package/dist/esm/tasks/reinforcement-learning/data.d.ts +4 -0
- package/dist/esm/tasks/reinforcement-learning/data.d.ts.map +1 -0
- package/dist/esm/tasks/reinforcement-learning/data.js +67 -0
- package/dist/esm/tasks/sentence-similarity/data.d.ts +4 -0
- package/dist/esm/tasks/sentence-similarity/data.d.ts.map +1 -0
- package/dist/esm/tasks/sentence-similarity/data.js +93 -0
- package/dist/esm/tasks/sentence-similarity/inference.d.ts +32 -0
- package/dist/esm/tasks/sentence-similarity/inference.d.ts.map +1 -0
- package/dist/esm/tasks/sentence-similarity/inference.js +6 -0
- package/dist/esm/tasks/summarization/data.d.ts +4 -0
- package/dist/esm/tasks/summarization/data.d.ts.map +1 -0
- package/dist/esm/tasks/summarization/data.js +67 -0
- package/dist/esm/tasks/summarization/inference.d.ts +56 -0
- package/dist/esm/tasks/summarization/inference.d.ts.map +1 -0
- package/dist/esm/tasks/summarization/inference.js +6 -0
- package/dist/esm/tasks/table-question-answering/data.d.ts +4 -0
- package/dist/esm/tasks/table-question-answering/data.d.ts.map +1 -0
- package/dist/esm/tasks/table-question-answering/data.js +52 -0
- package/dist/esm/tasks/table-question-answering/inference.d.ts +62 -0
- package/dist/esm/tasks/table-question-answering/inference.d.ts.map +1 -0
- package/dist/esm/tasks/table-question-answering/inference.js +1 -0
- package/dist/esm/tasks/tabular-classification/data.d.ts +4 -0
- package/dist/esm/tasks/tabular-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/tabular-classification/data.js +65 -0
- package/dist/esm/tasks/tabular-regression/data.d.ts +4 -0
- package/dist/esm/tasks/tabular-regression/data.d.ts.map +1 -0
- package/dist/esm/tasks/tabular-regression/data.js +53 -0
- package/dist/esm/tasks/text-classification/data.d.ts +4 -0
- package/dist/esm/tasks/text-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/text-classification/data.js +98 -0
- package/dist/esm/tasks/text-classification/inference.d.ts +52 -0
- package/dist/esm/tasks/text-classification/inference.d.ts.map +1 -0
- package/dist/esm/tasks/text-classification/inference.js +1 -0
- package/dist/esm/tasks/text-generation/data.d.ts +4 -0
- package/dist/esm/tasks/text-generation/data.d.ts.map +1 -0
- package/dist/esm/tasks/text-generation/data.js +106 -0
- package/dist/esm/tasks/text-generation/inference.d.ts +188 -0
- package/dist/esm/tasks/text-generation/inference.d.ts.map +1 -0
- package/dist/esm/tasks/text-generation/inference.js +6 -0
- package/dist/esm/tasks/text-to-3d/data.d.ts +4 -0
- package/dist/esm/tasks/text-to-3d/data.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-3d/data.js +53 -0
- package/dist/esm/tasks/text-to-audio/inference.d.ts +139 -0
- package/dist/esm/tasks/text-to-audio/inference.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-audio/inference.js +6 -0
- package/dist/esm/tasks/text-to-image/data.d.ts +4 -0
- package/dist/esm/tasks/text-to-image/data.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-image/data.js +93 -0
- package/dist/esm/tasks/text-to-image/inference.d.ts +72 -0
- package/dist/esm/tasks/text-to-image/inference.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-image/inference.js +6 -0
- package/dist/esm/tasks/text-to-speech/data.d.ts +4 -0
- package/dist/esm/tasks/text-to-speech/data.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-speech/data.js +74 -0
- package/dist/esm/tasks/text-to-speech/inference.d.ts +141 -0
- package/dist/esm/tasks/text-to-speech/inference.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-speech/inference.js +6 -0
- package/dist/esm/tasks/text-to-video/data.d.ts +4 -0
- package/dist/esm/tasks/text-to-video/data.d.ts.map +1 -0
- package/dist/esm/tasks/text-to-video/data.js +93 -0
- package/dist/esm/tasks/text2text-generation/inference.d.ts +54 -0
- package/dist/esm/tasks/text2text-generation/inference.d.ts.map +1 -0
- package/dist/esm/tasks/text2text-generation/inference.js +6 -0
- package/dist/esm/tasks/token-classification/data.d.ts +4 -0
- package/dist/esm/tasks/token-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/token-classification/data.js +85 -0
- package/dist/esm/tasks/token-classification/inference.d.ts +86 -0
- package/dist/esm/tasks/token-classification/inference.d.ts.map +1 -0
- package/dist/esm/tasks/token-classification/inference.js +1 -0
- package/dist/esm/tasks/translation/data.d.ts +4 -0
- package/dist/esm/tasks/translation/data.d.ts.map +1 -0
- package/dist/esm/tasks/translation/data.js +63 -0
- package/dist/esm/tasks/translation/inference.d.ts +66 -0
- package/dist/esm/tasks/translation/inference.d.ts.map +1 -0
- package/dist/esm/tasks/translation/inference.js +6 -0
- package/dist/esm/tasks/unconditional-image-generation/data.d.ts +4 -0
- package/dist/esm/tasks/unconditional-image-generation/data.d.ts.map +1 -0
- package/dist/esm/tasks/unconditional-image-generation/data.js +63 -0
- package/dist/esm/tasks/video-classification/data.d.ts +4 -0
- package/dist/esm/tasks/video-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/video-classification/data.js +80 -0
- package/dist/esm/tasks/video-classification/inference.d.ts +60 -0
- package/dist/esm/tasks/video-classification/inference.d.ts.map +1 -0
- package/dist/esm/tasks/video-classification/inference.js +1 -0
- package/dist/esm/tasks/video-text-to-text/data.d.ts +4 -0
- package/dist/esm/tasks/video-text-to-text/data.d.ts.map +1 -0
- package/dist/esm/tasks/video-text-to-text/data.js +61 -0
- package/dist/esm/tasks/visual-question-answering/data.d.ts +4 -0
- package/dist/esm/tasks/visual-question-answering/data.d.ts.map +1 -0
- package/dist/esm/tasks/visual-question-answering/data.js +91 -0
- package/dist/esm/tasks/visual-question-answering/inference.d.ts +63 -0
- package/dist/esm/tasks/visual-question-answering/inference.d.ts.map +1 -0
- package/dist/esm/tasks/visual-question-answering/inference.js +1 -0
- package/dist/esm/tasks/zero-shot-classification/data.d.ts +4 -0
- package/dist/esm/tasks/zero-shot-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/zero-shot-classification/data.js +64 -0
- package/dist/esm/tasks/zero-shot-classification/inference.d.ts +68 -0
- package/dist/esm/tasks/zero-shot-classification/inference.d.ts.map +1 -0
- package/dist/esm/tasks/zero-shot-classification/inference.js +1 -0
- package/dist/esm/tasks/zero-shot-image-classification/data.d.ts +4 -0
- package/dist/esm/tasks/zero-shot-image-classification/data.d.ts.map +1 -0
- package/dist/esm/tasks/zero-shot-image-classification/data.js +79 -0
- package/dist/esm/tasks/zero-shot-image-classification/inference.d.ts +62 -0
- package/dist/esm/tasks/zero-shot-image-classification/inference.d.ts.map +1 -0
- package/dist/esm/tasks/zero-shot-image-classification/inference.js +1 -0
- package/dist/esm/tasks/zero-shot-object-detection/data.d.ts +4 -0
- package/dist/esm/tasks/zero-shot-object-detection/data.d.ts.map +1 -0
- package/dist/esm/tasks/zero-shot-object-detection/data.js +60 -0
- package/dist/esm/tasks/zero-shot-object-detection/inference.d.ts +67 -0
- package/dist/esm/tasks/zero-shot-object-detection/inference.d.ts.map +1 -0
- package/dist/esm/tasks/zero-shot-object-detection/inference.js +1 -0
- package/dist/esm/tokenizer-data.d.ts +26 -0
- package/dist/esm/tokenizer-data.d.ts.map +1 -0
- package/dist/esm/tokenizer-data.js +10 -0
- package/dist/esm/widget-example.d.ts +83 -0
- package/dist/esm/widget-example.d.ts.map +1 -0
- package/dist/esm/widget-example.js +4 -0
- package/package.json +24 -20
- package/src/default-widget-inputs.ts +2 -2
- package/src/index.ts +23 -19
- package/src/library-to-tasks.ts +2 -2
- package/src/local-apps.ts +3 -3
- package/src/model-data.ts +3 -3
- package/src/model-libraries-snippets.ts +3 -3
- package/src/model-libraries.ts +3 -3
- package/src/snippets/common.ts +1 -1
- package/src/snippets/curl.spec.ts +2 -2
- package/src/snippets/index.ts +5 -4
- package/src/snippets/inputs.ts +3 -3
- package/src/snippets/js.spec.ts +10 -10
- package/src/snippets/js.ts +8 -8
- package/src/snippets/python.spec.ts +39 -2
- package/src/snippets/python.ts +22 -5
- package/src/snippets/types.ts +1 -1
- package/src/tasks/audio-classification/data.ts +1 -1
- package/src/tasks/audio-to-audio/data.ts +1 -1
- package/src/tasks/automatic-speech-recognition/data.ts +1 -1
- package/src/tasks/depth-estimation/data.ts +1 -1
- package/src/tasks/document-question-answering/data.ts +1 -1
- package/src/tasks/feature-extraction/data.ts +1 -1
- package/src/tasks/fill-mask/data.ts +1 -1
- package/src/tasks/image-classification/data.ts +1 -1
- package/src/tasks/image-feature-extraction/data.ts +1 -1
- package/src/tasks/image-segmentation/data.ts +1 -1
- package/src/tasks/image-text-to-text/data.ts +1 -1
- package/src/tasks/image-to-3d/data.ts +1 -1
- package/src/tasks/image-to-image/data.ts +1 -1
- package/src/tasks/image-to-text/data.ts +1 -1
- package/src/tasks/index.ts +70 -70
- package/src/tasks/keypoint-detection/data.ts +1 -1
- package/src/tasks/mask-generation/data.ts +1 -1
- package/src/tasks/object-detection/data.ts +1 -1
- package/src/tasks/placeholder/data.ts +1 -1
- package/src/tasks/question-answering/data.ts +1 -1
- package/src/tasks/reinforcement-learning/data.ts +1 -1
- package/src/tasks/sentence-similarity/data.ts +1 -1
- package/src/tasks/summarization/data.ts +1 -1
- package/src/tasks/table-question-answering/data.ts +1 -1
- package/src/tasks/tabular-classification/data.ts +1 -1
- package/src/tasks/tabular-regression/data.ts +1 -1
- package/src/tasks/text-classification/data.ts +1 -1
- package/src/tasks/text-generation/data.ts +1 -1
- package/src/tasks/text-to-3d/data.ts +1 -1
- package/src/tasks/text-to-image/data.ts +1 -1
- package/src/tasks/text-to-speech/data.ts +1 -1
- package/src/tasks/text-to-video/data.ts +1 -1
- package/src/tasks/token-classification/data.ts +1 -1
- package/src/tasks/translation/data.ts +1 -1
- package/src/tasks/unconditional-image-generation/data.ts +1 -1
- package/src/tasks/video-classification/data.ts +1 -1
- package/src/tasks/video-text-to-text/data.ts +1 -1
- package/src/tasks/visual-question-answering/data.ts +1 -1
- package/src/tasks/zero-shot-classification/data.ts +1 -1
- package/src/tasks/zero-shot-image-classification/data.ts +1 -1
- package/src/tasks/zero-shot-object-detection/data.ts +1 -1
- package/src/widget-example.ts +1 -1
- package/tsconfig.json +3 -3
- package/dist/index.cjs +0 -7976
- package/dist/index.js +0 -7933
- package/dist/scripts/inference-codegen.d.ts +0 -2
- package/dist/scripts/inference-codegen.d.ts.map +0 -1
- package/dist/scripts/inference-tei-import.d.ts +0 -2
- package/dist/scripts/inference-tei-import.d.ts.map +0 -1
- package/dist/scripts/inference-tgi-import.d.ts +0 -2
- package/dist/scripts/inference-tgi-import.d.ts.map +0 -1
- package/dist/src/default-widget-inputs.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/library-to-tasks.d.ts.map +0 -1
- package/dist/src/local-apps.d.ts.map +0 -1
- package/dist/src/model-data.d.ts.map +0 -1
- package/dist/src/model-libraries-snippets.d.ts.map +0 -1
- package/dist/src/snippets/common.d.ts.map +0 -1
- package/dist/src/snippets/index.d.ts +0 -6
- package/dist/src/snippets/index.d.ts.map +0 -1
- package/dist/src/snippets/inputs.d.ts +0 -4
- package/dist/src/snippets/inputs.d.ts.map +0 -1
- package/dist/src/snippets/types.d.ts.map +0 -1
- package/dist/src/tasks/audio-classification/data.d.ts +0 -4
- package/dist/src/tasks/audio-to-audio/data.d.ts +0 -4
- package/dist/src/tasks/automatic-speech-recognition/data.d.ts +0 -4
- package/dist/src/tasks/depth-estimation/data.d.ts +0 -4
- package/dist/src/tasks/document-question-answering/data.d.ts +0 -4
- package/dist/src/tasks/feature-extraction/data.d.ts +0 -4
- package/dist/src/tasks/fill-mask/data.d.ts +0 -4
- package/dist/src/tasks/image-classification/data.d.ts +0 -4
- package/dist/src/tasks/image-feature-extraction/data.d.ts +0 -4
- package/dist/src/tasks/image-segmentation/data.d.ts +0 -4
- package/dist/src/tasks/image-text-to-text/data.d.ts +0 -4
- package/dist/src/tasks/image-to-3d/data.d.ts +0 -4
- package/dist/src/tasks/image-to-image/data.d.ts +0 -4
- package/dist/src/tasks/image-to-text/data.d.ts +0 -4
- package/dist/src/tasks/index.d.ts.map +0 -1
- package/dist/src/tasks/keypoint-detection/data.d.ts +0 -4
- package/dist/src/tasks/mask-generation/data.d.ts +0 -4
- package/dist/src/tasks/object-detection/data.d.ts +0 -4
- package/dist/src/tasks/placeholder/data.d.ts +0 -4
- package/dist/src/tasks/question-answering/data.d.ts +0 -4
- package/dist/src/tasks/reinforcement-learning/data.d.ts +0 -4
- package/dist/src/tasks/sentence-similarity/data.d.ts +0 -4
- package/dist/src/tasks/summarization/data.d.ts +0 -4
- package/dist/src/tasks/table-question-answering/data.d.ts +0 -4
- package/dist/src/tasks/tabular-classification/data.d.ts +0 -4
- package/dist/src/tasks/tabular-regression/data.d.ts +0 -4
- package/dist/src/tasks/text-classification/data.d.ts +0 -4
- package/dist/src/tasks/text-generation/data.d.ts +0 -4
- package/dist/src/tasks/text-to-3d/data.d.ts +0 -4
- package/dist/src/tasks/text-to-image/data.d.ts +0 -4
- package/dist/src/tasks/text-to-speech/data.d.ts +0 -4
- package/dist/src/tasks/text-to-video/data.d.ts +0 -4
- package/dist/src/tasks/token-classification/data.d.ts +0 -4
- package/dist/src/tasks/translation/data.d.ts +0 -4
- package/dist/src/tasks/unconditional-image-generation/data.d.ts +0 -4
- package/dist/src/tasks/video-classification/data.d.ts +0 -4
- package/dist/src/tasks/video-text-to-text/data.d.ts +0 -4
- package/dist/src/tasks/visual-question-answering/data.d.ts +0 -4
- package/dist/src/tasks/zero-shot-classification/data.d.ts +0 -4
- package/dist/src/tasks/zero-shot-image-classification/data.d.ts +0 -4
- package/dist/src/tasks/zero-shot-object-detection/data.d.ts +0 -4
- package/dist/src/widget-example.d.ts.map +0 -1
- /package/dist/{src → commonjs}/dataset-libraries.d.ts +0 -0
- /package/dist/{src → commonjs}/dataset-libraries.d.ts.map +0 -0
- /package/dist/{src → commonjs}/gguf.d.ts +0 -0
- /package/dist/{src → commonjs}/gguf.d.ts.map +0 -0
- /package/dist/{src → commonjs}/hardware.d.ts +0 -0
- /package/dist/{src → commonjs}/hardware.d.ts.map +0 -0
- /package/dist/{src → commonjs}/model-libraries-downloads.d.ts +0 -0
- /package/dist/{src → commonjs}/model-libraries-downloads.d.ts.map +0 -0
- /package/dist/{src → commonjs}/snippets/curl.d.ts +0 -0
- /package/dist/{src → commonjs}/snippets/curl.d.ts.map +0 -0
- /package/dist/{src → commonjs}/snippets/curl.spec.d.ts +0 -0
- /package/dist/{src → commonjs}/snippets/curl.spec.d.ts.map +0 -0
- /package/dist/{src → commonjs}/snippets/js.d.ts +0 -0
- /package/dist/{src → commonjs}/snippets/js.d.ts.map +0 -0
- /package/dist/{src → commonjs}/snippets/js.spec.d.ts +0 -0
- /package/dist/{src → commonjs}/snippets/js.spec.d.ts.map +0 -0
- /package/dist/{src → commonjs}/snippets/python.spec.d.ts +0 -0
- /package/dist/{src → commonjs}/snippets/python.spec.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/audio-classification/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/audio-classification/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/automatic-speech-recognition/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/automatic-speech-recognition/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/chat-completion/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/chat-completion/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/depth-estimation/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/depth-estimation/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/document-question-answering/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/document-question-answering/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/feature-extraction/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/feature-extraction/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/fill-mask/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/fill-mask/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/image-classification/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/image-classification/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/image-segmentation/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/image-segmentation/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/image-to-image/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/image-to-image/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/image-to-text/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/image-to-text/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/object-detection/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/object-detection/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/question-answering/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/question-answering/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/sentence-similarity/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/sentence-similarity/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/summarization/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/summarization/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/table-question-answering/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/table-question-answering/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/text-classification/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/text-classification/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/text-generation/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/text-generation/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/text-to-audio/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/text-to-audio/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/text-to-image/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/text-to-image/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/text-to-speech/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/text-to-speech/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/text2text-generation/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/text2text-generation/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/token-classification/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/token-classification/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/translation/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/translation/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/video-classification/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/video-classification/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/visual-question-answering/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/visual-question-answering/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/zero-shot-classification/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/zero-shot-classification/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/zero-shot-image-classification/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/zero-shot-image-classification/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tasks/zero-shot-object-detection/inference.d.ts +0 -0
- /package/dist/{src → commonjs}/tasks/zero-shot-object-detection/inference.d.ts.map +0 -0
- /package/dist/{src → commonjs}/tokenizer-data.d.ts +0 -0
- /package/dist/{src → commonjs}/tokenizer-data.d.ts.map +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringifyMessages = stringifyMessages;
|
|
4
|
+
exports.stringifyGenerationConfig = stringifyGenerationConfig;
|
|
5
|
+
function stringifyMessages(messages, opts) {
|
|
6
|
+
let messagesStr = JSON.stringify(messages, null, "\t");
|
|
7
|
+
if (opts?.indent) {
|
|
8
|
+
messagesStr = messagesStr.replaceAll("\n", `\n${opts.indent}`);
|
|
9
|
+
}
|
|
10
|
+
if (!opts?.attributeKeyQuotes) {
|
|
11
|
+
messagesStr = messagesStr.replace(/"([^"]+)":/g, "$1:");
|
|
12
|
+
}
|
|
13
|
+
if (opts?.customContentEscaper) {
|
|
14
|
+
messagesStr = opts.customContentEscaper(messagesStr);
|
|
15
|
+
}
|
|
16
|
+
return messagesStr;
|
|
17
|
+
}
|
|
18
|
+
function stringifyGenerationConfig(config, opts) {
|
|
19
|
+
const quote = opts.attributeKeyQuotes ? `"` : "";
|
|
20
|
+
return Object.entries(config)
|
|
21
|
+
.map(([key, val]) => `${quote}${key}${quote}${opts.attributeValueConnector}${val}`)
|
|
22
|
+
.join(`,${opts.indent}`);
|
|
23
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.curlSnippets = exports.snippetFile = exports.snippetZeroShotClassification = exports.snippetTextGeneration = exports.snippetBasic = void 0;
|
|
4
|
+
exports.getCurlInferenceSnippet = getCurlInferenceSnippet;
|
|
5
|
+
exports.hasCurlInferenceSnippet = hasCurlInferenceSnippet;
|
|
6
|
+
const common_js_1 = require("./common.js");
|
|
7
|
+
const inputs_js_1 = require("./inputs.js");
|
|
8
|
+
const snippetBasic = (model, accessToken) => ({
|
|
9
|
+
content: `curl https://api-inference.huggingface.co/models/${model.id} \\
|
|
10
|
+
-X POST \\
|
|
11
|
+
-d '{"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model, true)}}' \\
|
|
12
|
+
-H 'Content-Type: application/json' \\
|
|
13
|
+
-H "Authorization: Bearer ${accessToken || `{API_TOKEN}`}"`,
|
|
14
|
+
});
|
|
15
|
+
exports.snippetBasic = snippetBasic;
|
|
16
|
+
const snippetTextGeneration = (model, accessToken, opts) => {
|
|
17
|
+
if (model.tags.includes("conversational")) {
|
|
18
|
+
// Conversational model detected, so we display a code snippet that features the Messages API
|
|
19
|
+
const streaming = opts?.streaming ?? true;
|
|
20
|
+
const exampleMessages = (0, inputs_js_1.getModelInputSnippet)(model);
|
|
21
|
+
const messages = opts?.messages ?? exampleMessages;
|
|
22
|
+
const config = {
|
|
23
|
+
...(opts?.temperature ? { temperature: opts.temperature } : undefined),
|
|
24
|
+
max_tokens: opts?.max_tokens ?? 500,
|
|
25
|
+
...(opts?.top_p ? { top_p: opts.top_p } : undefined),
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
content: `curl 'https://api-inference.huggingface.co/models/${model.id}/v1/chat/completions' \\
|
|
29
|
+
-H "Authorization: Bearer ${accessToken || `{API_TOKEN}`}" \\
|
|
30
|
+
-H 'Content-Type: application/json' \\
|
|
31
|
+
--data '{
|
|
32
|
+
"model": "${model.id}",
|
|
33
|
+
"messages": ${(0, common_js_1.stringifyMessages)(messages, {
|
|
34
|
+
indent: "\t",
|
|
35
|
+
attributeKeyQuotes: true,
|
|
36
|
+
customContentEscaper: (str) => str.replace(/'/g, "'\\''"),
|
|
37
|
+
})},
|
|
38
|
+
${(0, common_js_1.stringifyGenerationConfig)(config, {
|
|
39
|
+
indent: "\n ",
|
|
40
|
+
attributeKeyQuotes: true,
|
|
41
|
+
attributeValueConnector: ": ",
|
|
42
|
+
})},
|
|
43
|
+
"stream": ${!!streaming}
|
|
44
|
+
}'`,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return (0, exports.snippetBasic)(model, accessToken);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.snippetTextGeneration = snippetTextGeneration;
|
|
52
|
+
const snippetZeroShotClassification = (model, accessToken) => ({
|
|
53
|
+
content: `curl https://api-inference.huggingface.co/models/${model.id} \\
|
|
54
|
+
-X POST \\
|
|
55
|
+
-d '{"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model, true)}, "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}' \\
|
|
56
|
+
-H 'Content-Type: application/json' \\
|
|
57
|
+
-H "Authorization: Bearer ${accessToken || `{API_TOKEN}`}"`,
|
|
58
|
+
});
|
|
59
|
+
exports.snippetZeroShotClassification = snippetZeroShotClassification;
|
|
60
|
+
const snippetFile = (model, accessToken) => ({
|
|
61
|
+
content: `curl https://api-inference.huggingface.co/models/${model.id} \\
|
|
62
|
+
-X POST \\
|
|
63
|
+
--data-binary '@${(0, inputs_js_1.getModelInputSnippet)(model, true, true)}' \\
|
|
64
|
+
-H "Authorization: Bearer ${accessToken || `{API_TOKEN}`}"`,
|
|
65
|
+
});
|
|
66
|
+
exports.snippetFile = snippetFile;
|
|
67
|
+
exports.curlSnippets = {
|
|
68
|
+
// Same order as in js/src/lib/interfaces/Types.ts
|
|
69
|
+
"text-classification": exports.snippetBasic,
|
|
70
|
+
"token-classification": exports.snippetBasic,
|
|
71
|
+
"table-question-answering": exports.snippetBasic,
|
|
72
|
+
"question-answering": exports.snippetBasic,
|
|
73
|
+
"zero-shot-classification": exports.snippetZeroShotClassification,
|
|
74
|
+
translation: exports.snippetBasic,
|
|
75
|
+
summarization: exports.snippetBasic,
|
|
76
|
+
"feature-extraction": exports.snippetBasic,
|
|
77
|
+
"text-generation": exports.snippetTextGeneration,
|
|
78
|
+
"image-text-to-text": exports.snippetTextGeneration,
|
|
79
|
+
"text2text-generation": exports.snippetBasic,
|
|
80
|
+
"fill-mask": exports.snippetBasic,
|
|
81
|
+
"sentence-similarity": exports.snippetBasic,
|
|
82
|
+
"automatic-speech-recognition": exports.snippetFile,
|
|
83
|
+
"text-to-image": exports.snippetBasic,
|
|
84
|
+
"text-to-speech": exports.snippetBasic,
|
|
85
|
+
"text-to-audio": exports.snippetBasic,
|
|
86
|
+
"audio-to-audio": exports.snippetFile,
|
|
87
|
+
"audio-classification": exports.snippetFile,
|
|
88
|
+
"image-classification": exports.snippetFile,
|
|
89
|
+
"image-to-text": exports.snippetFile,
|
|
90
|
+
"object-detection": exports.snippetFile,
|
|
91
|
+
"image-segmentation": exports.snippetFile,
|
|
92
|
+
};
|
|
93
|
+
function getCurlInferenceSnippet(model, accessToken, opts) {
|
|
94
|
+
return model.pipeline_tag && model.pipeline_tag in exports.curlSnippets
|
|
95
|
+
? exports.curlSnippets[model.pipeline_tag]?.(model, accessToken, opts) ?? { content: "" }
|
|
96
|
+
: { content: "" };
|
|
97
|
+
}
|
|
98
|
+
function hasCurlInferenceSnippet(model) {
|
|
99
|
+
return !!model.pipeline_tag && model.pipeline_tag in exports.curlSnippets;
|
|
100
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const curl_js_1 = require("./curl.js");
|
|
5
|
+
(0, vitest_1.describe)("inference API snippets", () => {
|
|
6
|
+
(0, vitest_1.it)("conversational llm", async () => {
|
|
7
|
+
const model = {
|
|
8
|
+
id: "meta-llama/Llama-3.1-8B-Instruct",
|
|
9
|
+
pipeline_tag: "text-generation",
|
|
10
|
+
tags: ["conversational"],
|
|
11
|
+
inference: "",
|
|
12
|
+
};
|
|
13
|
+
const snippet = (0, curl_js_1.getCurlInferenceSnippet)(model, "api_token");
|
|
14
|
+
(0, vitest_1.expect)(snippet.content)
|
|
15
|
+
.toEqual(`curl 'https://api-inference.huggingface.co/models/meta-llama/Llama-3.1-8B-Instruct/v1/chat/completions' \\
|
|
16
|
+
-H "Authorization: Bearer api_token" \\
|
|
17
|
+
-H 'Content-Type: application/json' \\
|
|
18
|
+
--data '{
|
|
19
|
+
"model": "meta-llama/Llama-3.1-8B-Instruct",
|
|
20
|
+
"messages": [
|
|
21
|
+
{
|
|
22
|
+
"role": "user",
|
|
23
|
+
"content": "What is the capital of France?"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"max_tokens": 500,
|
|
27
|
+
"stream": true
|
|
28
|
+
}'`);
|
|
29
|
+
});
|
|
30
|
+
(0, vitest_1.it)("conversational llm non-streaming", async () => {
|
|
31
|
+
const model = {
|
|
32
|
+
id: "meta-llama/Llama-3.1-8B-Instruct",
|
|
33
|
+
pipeline_tag: "text-generation",
|
|
34
|
+
tags: ["conversational"],
|
|
35
|
+
inference: "",
|
|
36
|
+
};
|
|
37
|
+
const snippet = (0, curl_js_1.getCurlInferenceSnippet)(model, "api_token", { streaming: false });
|
|
38
|
+
(0, vitest_1.expect)(snippet.content)
|
|
39
|
+
.toEqual(`curl 'https://api-inference.huggingface.co/models/meta-llama/Llama-3.1-8B-Instruct/v1/chat/completions' \\
|
|
40
|
+
-H "Authorization: Bearer api_token" \\
|
|
41
|
+
-H 'Content-Type: application/json' \\
|
|
42
|
+
--data '{
|
|
43
|
+
"model": "meta-llama/Llama-3.1-8B-Instruct",
|
|
44
|
+
"messages": [
|
|
45
|
+
{
|
|
46
|
+
"role": "user",
|
|
47
|
+
"content": "What is the capital of France?"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"max_tokens": 500,
|
|
51
|
+
"stream": false
|
|
52
|
+
}'`);
|
|
53
|
+
});
|
|
54
|
+
(0, vitest_1.it)("conversational vlm", async () => {
|
|
55
|
+
const model = {
|
|
56
|
+
id: "meta-llama/Llama-3.2-11B-Vision-Instruct",
|
|
57
|
+
pipeline_tag: "image-text-to-text",
|
|
58
|
+
tags: ["conversational"],
|
|
59
|
+
inference: "",
|
|
60
|
+
};
|
|
61
|
+
const snippet = (0, curl_js_1.getCurlInferenceSnippet)(model, "api_token");
|
|
62
|
+
(0, vitest_1.expect)(snippet.content)
|
|
63
|
+
.toEqual(`curl 'https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1/chat/completions' \\
|
|
64
|
+
-H "Authorization: Bearer api_token" \\
|
|
65
|
+
-H 'Content-Type: application/json' \\
|
|
66
|
+
--data '{
|
|
67
|
+
"model": "meta-llama/Llama-3.2-11B-Vision-Instruct",
|
|
68
|
+
"messages": [
|
|
69
|
+
{
|
|
70
|
+
"role": "user",
|
|
71
|
+
"content": [
|
|
72
|
+
{
|
|
73
|
+
"type": "text",
|
|
74
|
+
"text": "Describe this image in one sentence."
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"type": "image_url",
|
|
78
|
+
"image_url": {
|
|
79
|
+
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"max_tokens": 500,
|
|
86
|
+
"stream": true
|
|
87
|
+
}'`);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/snippets/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.js = exports.python = exports.curl = exports.inputs = void 0;
|
|
30
|
+
const inputs = __importStar(require("./inputs.js"));
|
|
31
|
+
exports.inputs = inputs;
|
|
32
|
+
const curl = __importStar(require("./curl.js"));
|
|
33
|
+
exports.curl = curl;
|
|
34
|
+
const python = __importStar(require("./python.js"));
|
|
35
|
+
exports.python = python;
|
|
36
|
+
const js = __importStar(require("./js.js"));
|
|
37
|
+
exports.js = js;
|
|
38
|
+
__exportStar(require("./types.js"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChatCompletionInputMessage } from "../tasks/index.js";
|
|
2
|
+
import type { ModelDataMinimal } from "./types.js";
|
|
3
|
+
export declare function getModelInputSnippet(model: ModelDataMinimal, noWrap?: boolean, noQuotes?: boolean): string | ChatCompletionInputMessage[];
|
|
4
|
+
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../src/snippets/inputs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA6InD,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,gBAAgB,EACvB,MAAM,UAAQ,EACd,QAAQ,UAAQ,GACd,MAAM,GAAG,0BAA0B,EAAE,CAmBvC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getModelInputSnippet = getModelInputSnippet;
|
|
4
|
+
const inputsZeroShotClassification = () => `"Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!"`;
|
|
5
|
+
const inputsTranslation = () => `"Меня зовут Вольфганг и я живу в Берлине"`;
|
|
6
|
+
const inputsSummarization = () => `"The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."`;
|
|
7
|
+
const inputsTableQuestionAnswering = () => `{
|
|
8
|
+
"query": "How many stars does the transformers repository have?",
|
|
9
|
+
"table": {
|
|
10
|
+
"Repository": ["Transformers", "Datasets", "Tokenizers"],
|
|
11
|
+
"Stars": ["36542", "4512", "3934"],
|
|
12
|
+
"Contributors": ["651", "77", "34"],
|
|
13
|
+
"Programming language": [
|
|
14
|
+
"Python",
|
|
15
|
+
"Python",
|
|
16
|
+
"Rust, Python and NodeJS"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}`;
|
|
20
|
+
const inputsVisualQuestionAnswering = () => `{
|
|
21
|
+
"image": "cat.png",
|
|
22
|
+
"question": "What is in this image?"
|
|
23
|
+
}`;
|
|
24
|
+
const inputsQuestionAnswering = () => `{
|
|
25
|
+
"question": "What is my name?",
|
|
26
|
+
"context": "My name is Clara and I live in Berkeley."
|
|
27
|
+
}`;
|
|
28
|
+
const inputsTextClassification = () => `"I like you. I love you"`;
|
|
29
|
+
const inputsTokenClassification = () => `"My name is Sarah Jessica Parker but you can call me Jessica"`;
|
|
30
|
+
const inputsTextGeneration = (model) => {
|
|
31
|
+
if (model.tags.includes("conversational")) {
|
|
32
|
+
return model.pipeline_tag === "text-generation"
|
|
33
|
+
? [{ role: "user", content: "What is the capital of France?" }]
|
|
34
|
+
: [
|
|
35
|
+
{
|
|
36
|
+
role: "user",
|
|
37
|
+
content: [
|
|
38
|
+
{
|
|
39
|
+
type: "text",
|
|
40
|
+
text: "Describe this image in one sentence.",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "image_url",
|
|
44
|
+
image_url: {
|
|
45
|
+
url: "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
return `"Can you please let us know more details about your "`;
|
|
53
|
+
};
|
|
54
|
+
const inputsText2TextGeneration = () => `"The answer to the universe is"`;
|
|
55
|
+
const inputsFillMask = (model) => `"The answer to the universe is ${model.mask_token}."`;
|
|
56
|
+
const inputsSentenceSimilarity = () => `{
|
|
57
|
+
"source_sentence": "That is a happy person",
|
|
58
|
+
"sentences": [
|
|
59
|
+
"That is a happy dog",
|
|
60
|
+
"That is a very happy person",
|
|
61
|
+
"Today is a sunny day"
|
|
62
|
+
]
|
|
63
|
+
}`;
|
|
64
|
+
const inputsFeatureExtraction = () => `"Today is a sunny day and I will get some ice cream."`;
|
|
65
|
+
const inputsImageClassification = () => `"cats.jpg"`;
|
|
66
|
+
const inputsImageToText = () => `"cats.jpg"`;
|
|
67
|
+
const inputsImageSegmentation = () => `"cats.jpg"`;
|
|
68
|
+
const inputsObjectDetection = () => `"cats.jpg"`;
|
|
69
|
+
const inputsAudioToAudio = () => `"sample1.flac"`;
|
|
70
|
+
const inputsAudioClassification = () => `"sample1.flac"`;
|
|
71
|
+
const inputsTextToImage = () => `"Astronaut riding a horse"`;
|
|
72
|
+
const inputsTextToSpeech = () => `"The answer to the universe is 42"`;
|
|
73
|
+
const inputsTextToAudio = () => `"liquid drum and bass, atmospheric synths, airy sounds"`;
|
|
74
|
+
const inputsAutomaticSpeechRecognition = () => `"sample1.flac"`;
|
|
75
|
+
const inputsTabularPrediction = () => `'{"Height":[11.52,12.48],"Length1":[23.2,24.0],"Length2":[25.4,26.3],"Species": ["Bream","Bream"]}'`;
|
|
76
|
+
const inputsZeroShotImageClassification = () => `"cats.jpg"`;
|
|
77
|
+
const modelInputSnippets = {
|
|
78
|
+
"audio-to-audio": inputsAudioToAudio,
|
|
79
|
+
"audio-classification": inputsAudioClassification,
|
|
80
|
+
"automatic-speech-recognition": inputsAutomaticSpeechRecognition,
|
|
81
|
+
"document-question-answering": inputsVisualQuestionAnswering,
|
|
82
|
+
"feature-extraction": inputsFeatureExtraction,
|
|
83
|
+
"fill-mask": inputsFillMask,
|
|
84
|
+
"image-classification": inputsImageClassification,
|
|
85
|
+
"image-to-text": inputsImageToText,
|
|
86
|
+
"image-segmentation": inputsImageSegmentation,
|
|
87
|
+
"object-detection": inputsObjectDetection,
|
|
88
|
+
"question-answering": inputsQuestionAnswering,
|
|
89
|
+
"sentence-similarity": inputsSentenceSimilarity,
|
|
90
|
+
summarization: inputsSummarization,
|
|
91
|
+
"table-question-answering": inputsTableQuestionAnswering,
|
|
92
|
+
"tabular-regression": inputsTabularPrediction,
|
|
93
|
+
"tabular-classification": inputsTabularPrediction,
|
|
94
|
+
"text-classification": inputsTextClassification,
|
|
95
|
+
"text-generation": inputsTextGeneration,
|
|
96
|
+
"image-text-to-text": inputsTextGeneration,
|
|
97
|
+
"text-to-image": inputsTextToImage,
|
|
98
|
+
"text-to-speech": inputsTextToSpeech,
|
|
99
|
+
"text-to-audio": inputsTextToAudio,
|
|
100
|
+
"text2text-generation": inputsText2TextGeneration,
|
|
101
|
+
"token-classification": inputsTokenClassification,
|
|
102
|
+
translation: inputsTranslation,
|
|
103
|
+
"zero-shot-classification": inputsZeroShotClassification,
|
|
104
|
+
"zero-shot-image-classification": inputsZeroShotImageClassification,
|
|
105
|
+
};
|
|
106
|
+
// Use noWrap to put the whole snippet on a single line (removing new lines and tabulations)
|
|
107
|
+
// Use noQuotes to strip quotes from start & end (example: "abc" -> abc)
|
|
108
|
+
function getModelInputSnippet(model, noWrap = false, noQuotes = false) {
|
|
109
|
+
if (model.pipeline_tag) {
|
|
110
|
+
const inputs = modelInputSnippets[model.pipeline_tag];
|
|
111
|
+
if (inputs) {
|
|
112
|
+
let result = inputs(model);
|
|
113
|
+
if (typeof result === "string") {
|
|
114
|
+
if (noWrap) {
|
|
115
|
+
result = result.replace(/(?:(?:\r?\n|\r)\t*)|\t+/g, " ");
|
|
116
|
+
}
|
|
117
|
+
if (noQuotes) {
|
|
118
|
+
const REGEX_QUOTES = /^"(.+)"$/s;
|
|
119
|
+
const match = result.match(REGEX_QUOTES);
|
|
120
|
+
result = match ? match[1] : result;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return "No input example has been defined for this model task.";
|
|
127
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsSnippets = exports.snippetFile = exports.snippetTextToAudio = exports.snippetTextToImage = exports.snippetZeroShotClassification = exports.snippetTextGeneration = exports.snippetBasic = void 0;
|
|
4
|
+
exports.getJsInferenceSnippet = getJsInferenceSnippet;
|
|
5
|
+
exports.hasJsInferenceSnippet = hasJsInferenceSnippet;
|
|
6
|
+
const common_js_1 = require("./common.js");
|
|
7
|
+
const inputs_js_1 = require("./inputs.js");
|
|
8
|
+
const snippetBasic = (model, accessToken) => ({
|
|
9
|
+
content: `async function query(data) {
|
|
10
|
+
const response = await fetch(
|
|
11
|
+
"https://api-inference.huggingface.co/models/${model.id}",
|
|
12
|
+
{
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: "Bearer ${accessToken || `{API_TOKEN}`}"
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
},
|
|
17
|
+
method: "POST",
|
|
18
|
+
body: JSON.stringify(data),
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
const result = await response.json();
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
query({"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model)}}).then((response) => {
|
|
26
|
+
console.log(JSON.stringify(response));
|
|
27
|
+
});`,
|
|
28
|
+
});
|
|
29
|
+
exports.snippetBasic = snippetBasic;
|
|
30
|
+
const snippetTextGeneration = (model, accessToken, opts) => {
|
|
31
|
+
if (model.tags.includes("conversational")) {
|
|
32
|
+
// Conversational model detected, so we display a code snippet that features the Messages API
|
|
33
|
+
const streaming = opts?.streaming ?? true;
|
|
34
|
+
const exampleMessages = (0, inputs_js_1.getModelInputSnippet)(model);
|
|
35
|
+
const messages = opts?.messages ?? exampleMessages;
|
|
36
|
+
const messagesStr = (0, common_js_1.stringifyMessages)(messages, { indent: "\t" });
|
|
37
|
+
const config = {
|
|
38
|
+
...(opts?.temperature ? { temperature: opts.temperature } : undefined),
|
|
39
|
+
max_tokens: opts?.max_tokens ?? 500,
|
|
40
|
+
...(opts?.top_p ? { top_p: opts.top_p } : undefined),
|
|
41
|
+
};
|
|
42
|
+
const configStr = (0, common_js_1.stringifyGenerationConfig)(config, {
|
|
43
|
+
indent: "\n\t",
|
|
44
|
+
attributeValueConnector: ": ",
|
|
45
|
+
});
|
|
46
|
+
if (streaming) {
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
client: "huggingface.js",
|
|
50
|
+
content: `import { HfInference } from "@huggingface/inference";
|
|
51
|
+
|
|
52
|
+
const client = new HfInference("${accessToken || `{API_TOKEN}`}");
|
|
53
|
+
|
|
54
|
+
let out = "";
|
|
55
|
+
|
|
56
|
+
const stream = client.chatCompletionStream({
|
|
57
|
+
model: "${model.id}",
|
|
58
|
+
messages: ${messagesStr},
|
|
59
|
+
${configStr}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
for await (const chunk of stream) {
|
|
63
|
+
if (chunk.choices && chunk.choices.length > 0) {
|
|
64
|
+
const newContent = chunk.choices[0].delta.content;
|
|
65
|
+
out += newContent;
|
|
66
|
+
console.log(newContent);
|
|
67
|
+
}
|
|
68
|
+
}`,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
client: "openai",
|
|
72
|
+
content: `import { OpenAI } from "openai";
|
|
73
|
+
|
|
74
|
+
const client = new OpenAI({
|
|
75
|
+
baseURL: "https://api-inference.huggingface.co/v1/",
|
|
76
|
+
apiKey: "${accessToken || `{API_TOKEN}`}"
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
let out = "";
|
|
80
|
+
|
|
81
|
+
const stream = await client.chat.completions.create({
|
|
82
|
+
model: "${model.id}",
|
|
83
|
+
messages: ${messagesStr},
|
|
84
|
+
${configStr},
|
|
85
|
+
stream: true,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
for await (const chunk of stream) {
|
|
89
|
+
if (chunk.choices && chunk.choices.length > 0) {
|
|
90
|
+
const newContent = chunk.choices[0].delta.content;
|
|
91
|
+
out += newContent;
|
|
92
|
+
console.log(newContent);
|
|
93
|
+
}
|
|
94
|
+
}`,
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return [
|
|
100
|
+
{
|
|
101
|
+
client: "huggingface.js",
|
|
102
|
+
content: `import { HfInference } from "@huggingface/inference";
|
|
103
|
+
|
|
104
|
+
const client = new HfInference("${accessToken || `{API_TOKEN}`}");
|
|
105
|
+
|
|
106
|
+
const chatCompletion = await client.chatCompletion({
|
|
107
|
+
model: "${model.id}",
|
|
108
|
+
messages: ${messagesStr},
|
|
109
|
+
${configStr}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
console.log(chatCompletion.choices[0].message);`,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
client: "openai",
|
|
116
|
+
content: `import { OpenAI } from "openai";
|
|
117
|
+
|
|
118
|
+
const client = new OpenAI({
|
|
119
|
+
baseURL: "https://api-inference.huggingface.co/v1/",
|
|
120
|
+
apiKey: "${accessToken || `{API_TOKEN}`}"
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const chatCompletion = await client.chat.completions.create({
|
|
124
|
+
model: "${model.id}",
|
|
125
|
+
messages: ${messagesStr},
|
|
126
|
+
${configStr}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
console.log(chatCompletion.choices[0].message);`,
|
|
130
|
+
},
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
return (0, exports.snippetBasic)(model, accessToken);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
exports.snippetTextGeneration = snippetTextGeneration;
|
|
139
|
+
const snippetZeroShotClassification = (model, accessToken) => ({
|
|
140
|
+
content: `async function query(data) {
|
|
141
|
+
const response = await fetch(
|
|
142
|
+
"https://api-inference.huggingface.co/models/${model.id}",
|
|
143
|
+
{
|
|
144
|
+
headers: {
|
|
145
|
+
Authorization: "Bearer ${accessToken || `{API_TOKEN}`}"
|
|
146
|
+
"Content-Type": "application/json",
|
|
147
|
+
},
|
|
148
|
+
method: "POST",
|
|
149
|
+
body: JSON.stringify(data),
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
const result = await response.json();
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
query({"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model)}, "parameters": {"candidate_labels": ["refund", "legal", "faq"]}}).then((response) => {
|
|
157
|
+
console.log(JSON.stringify(response));
|
|
158
|
+
});`,
|
|
159
|
+
});
|
|
160
|
+
exports.snippetZeroShotClassification = snippetZeroShotClassification;
|
|
161
|
+
const snippetTextToImage = (model, accessToken) => ({
|
|
162
|
+
content: `async function query(data) {
|
|
163
|
+
const response = await fetch(
|
|
164
|
+
"https://api-inference.huggingface.co/models/${model.id}",
|
|
165
|
+
{
|
|
166
|
+
headers: {
|
|
167
|
+
Authorization: "Bearer ${accessToken || `{API_TOKEN}`}"
|
|
168
|
+
"Content-Type": "application/json",
|
|
169
|
+
},
|
|
170
|
+
method: "POST",
|
|
171
|
+
body: JSON.stringify(data),
|
|
172
|
+
}
|
|
173
|
+
);
|
|
174
|
+
const result = await response.blob();
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
query({"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model)}}).then((response) => {
|
|
178
|
+
// Use image
|
|
179
|
+
});`,
|
|
180
|
+
});
|
|
181
|
+
exports.snippetTextToImage = snippetTextToImage;
|
|
182
|
+
const snippetTextToAudio = (model, accessToken) => {
|
|
183
|
+
const commonSnippet = `async function query(data) {
|
|
184
|
+
const response = await fetch(
|
|
185
|
+
"https://api-inference.huggingface.co/models/${model.id}",
|
|
186
|
+
{
|
|
187
|
+
headers: {
|
|
188
|
+
Authorization: "Bearer ${accessToken || `{API_TOKEN}`}"
|
|
189
|
+
"Content-Type": "application/json",
|
|
190
|
+
},
|
|
191
|
+
method: "POST",
|
|
192
|
+
body: JSON.stringify(data),
|
|
193
|
+
}
|
|
194
|
+
);`;
|
|
195
|
+
if (model.library_name === "transformers") {
|
|
196
|
+
return {
|
|
197
|
+
content: commonSnippet +
|
|
198
|
+
`
|
|
199
|
+
const result = await response.blob();
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
query({"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model)}}).then((response) => {
|
|
203
|
+
// Returns a byte object of the Audio wavform. Use it directly!
|
|
204
|
+
});`,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return {
|
|
209
|
+
content: commonSnippet +
|
|
210
|
+
`
|
|
211
|
+
const result = await response.json();
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
query({"inputs": ${(0, inputs_js_1.getModelInputSnippet)(model)}}).then((response) => {
|
|
216
|
+
console.log(JSON.stringify(response));
|
|
217
|
+
});`,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
exports.snippetTextToAudio = snippetTextToAudio;
|
|
222
|
+
const snippetFile = (model, accessToken) => ({
|
|
223
|
+
content: `async function query(filename) {
|
|
224
|
+
const data = fs.readFileSync(filename);
|
|
225
|
+
const response = await fetch(
|
|
226
|
+
"https://api-inference.huggingface.co/models/${model.id}",
|
|
227
|
+
{
|
|
228
|
+
headers: {
|
|
229
|
+
Authorization: "Bearer ${accessToken || `{API_TOKEN}`}"
|
|
230
|
+
"Content-Type": "application/json",
|
|
231
|
+
},
|
|
232
|
+
method: "POST",
|
|
233
|
+
body: data,
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
const result = await response.json();
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
query(${(0, inputs_js_1.getModelInputSnippet)(model)}).then((response) => {
|
|
241
|
+
console.log(JSON.stringify(response));
|
|
242
|
+
});`,
|
|
243
|
+
});
|
|
244
|
+
exports.snippetFile = snippetFile;
|
|
245
|
+
exports.jsSnippets = {
|
|
246
|
+
// Same order as in js/src/lib/interfaces/Types.ts
|
|
247
|
+
"text-classification": exports.snippetBasic,
|
|
248
|
+
"token-classification": exports.snippetBasic,
|
|
249
|
+
"table-question-answering": exports.snippetBasic,
|
|
250
|
+
"question-answering": exports.snippetBasic,
|
|
251
|
+
"zero-shot-classification": exports.snippetZeroShotClassification,
|
|
252
|
+
translation: exports.snippetBasic,
|
|
253
|
+
summarization: exports.snippetBasic,
|
|
254
|
+
"feature-extraction": exports.snippetBasic,
|
|
255
|
+
"text-generation": exports.snippetTextGeneration,
|
|
256
|
+
"image-text-to-text": exports.snippetTextGeneration,
|
|
257
|
+
"text2text-generation": exports.snippetBasic,
|
|
258
|
+
"fill-mask": exports.snippetBasic,
|
|
259
|
+
"sentence-similarity": exports.snippetBasic,
|
|
260
|
+
"automatic-speech-recognition": exports.snippetFile,
|
|
261
|
+
"text-to-image": exports.snippetTextToImage,
|
|
262
|
+
"text-to-speech": exports.snippetTextToAudio,
|
|
263
|
+
"text-to-audio": exports.snippetTextToAudio,
|
|
264
|
+
"audio-to-audio": exports.snippetFile,
|
|
265
|
+
"audio-classification": exports.snippetFile,
|
|
266
|
+
"image-classification": exports.snippetFile,
|
|
267
|
+
"image-to-text": exports.snippetFile,
|
|
268
|
+
"object-detection": exports.snippetFile,
|
|
269
|
+
"image-segmentation": exports.snippetFile,
|
|
270
|
+
};
|
|
271
|
+
function getJsInferenceSnippet(model, accessToken, opts) {
|
|
272
|
+
return model.pipeline_tag && model.pipeline_tag in exports.jsSnippets
|
|
273
|
+
? exports.jsSnippets[model.pipeline_tag]?.(model, accessToken, opts) ?? { content: "" }
|
|
274
|
+
: { content: "" };
|
|
275
|
+
}
|
|
276
|
+
function hasJsInferenceSnippet(model) {
|
|
277
|
+
return !!model.pipeline_tag && model.pipeline_tag in exports.jsSnippets;
|
|
278
|
+
}
|