Buckets:

rtrm's picture
download
raw
425 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;pipelines&quot;,&quot;local&quot;:&quot;pipelines&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;pipelines.Pipeline&quot;,&quot;local&quot;:&quot;pipelinespipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new Pipeline(options)&quot;,&quot;local&quot;:&quot;new-pipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;pipeline.dispose() : <code> DisposeType </code>&quot;,&quot;local&quot;:&quot;pipelinedispose--code-disposetype-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TextClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinestextclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TextClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-textclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;textClassificationPipeline._call() : <code> TextClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;textclassificationpipelinecall--code-textclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TokenClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinestokenclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TokenClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-tokenclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;tokenClassificationPipeline._call() : <code> TokenClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;tokenclassificationpipelinecall--code-tokenclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.QuestionAnsweringPipeline&quot;,&quot;local&quot;:&quot;pipelinesquestionansweringpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new QuestionAnsweringPipeline(options)&quot;,&quot;local&quot;:&quot;new-questionansweringpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;questionAnsweringPipeline._call() : <code> QuestionAnsweringPipelineCallback </code>&quot;,&quot;local&quot;:&quot;questionansweringpipelinecall--code-questionansweringpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.FillMaskPipeline&quot;,&quot;local&quot;:&quot;pipelinesfillmaskpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new FillMaskPipeline(options)&quot;,&quot;local&quot;:&quot;new-fillmaskpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;fillMaskPipeline._call() : <code> FillMaskPipelineCallback </code>&quot;,&quot;local&quot;:&quot;fillmaskpipelinecall--code-fillmaskpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.Text2TextGenerationPipeline&quot;,&quot;local&quot;:&quot;pipelinestext2textgenerationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new Text2TextGenerationPipeline(options)&quot;,&quot;local&quot;:&quot;new-text2textgenerationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;text2TextGenerationPipeline._key : <code> ’ generated_text ’ </code>&quot;,&quot;local&quot;:&quot;text2textgenerationpipelinekey--code--generatedtext--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;text2TextGenerationPipeline._call() : <code> Text2TextGenerationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;text2textgenerationpipelinecall--code-text2textgenerationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.SummarizationPipeline&quot;,&quot;local&quot;:&quot;pipelinessummarizationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new SummarizationPipeline(options)&quot;,&quot;local&quot;:&quot;new-summarizationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;summarizationPipeline._key : <code> ’ summary_text ’ </code>&quot;,&quot;local&quot;:&quot;summarizationpipelinekey--code--summarytext--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TranslationPipeline&quot;,&quot;local&quot;:&quot;pipelinestranslationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TranslationPipeline(options)&quot;,&quot;local&quot;:&quot;new-translationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;translationPipeline._key : <code> ’ translation_text ’ </code>&quot;,&quot;local&quot;:&quot;translationpipelinekey--code--translationtext--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TextGenerationPipeline&quot;,&quot;local&quot;:&quot;pipelinestextgenerationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TextGenerationPipeline(options)&quot;,&quot;local&quot;:&quot;new-textgenerationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;textGenerationPipeline._call() : <code> TextGenerationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;textgenerationpipelinecall--code-textgenerationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotClassificationPipeline.model : <code> any </code>&quot;,&quot;local&quot;:&quot;zeroshotclassificationpipelinemodel--code-any-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotClassificationPipeline._call() : <code> ZeroShotClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotclassificationpipelinecall--code-zeroshotclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.FeatureExtractionPipeline&quot;,&quot;local&quot;:&quot;pipelinesfeatureextractionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new FeatureExtractionPipeline(options)&quot;,&quot;local&quot;:&quot;new-featureextractionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;featureExtractionPipeline._call() : <code> FeatureExtractionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;featureextractionpipelinecall--code-featureextractionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageFeatureExtractionPipeline&quot;,&quot;local&quot;:&quot;pipelinesimagefeatureextractionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageFeatureExtractionPipeline(options)&quot;,&quot;local&quot;:&quot;new-imagefeatureextractionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageFeatureExtractionPipeline._call() : <code> ImageFeatureExtractionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagefeatureextractionpipelinecall--code-imagefeatureextractionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.AudioClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinesaudioclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new AudioClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-audioclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;audioClassificationPipeline._call() : <code> AudioClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;audioclassificationpipelinecall--code-audioclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotAudioClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotaudioclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotAudioClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotaudioclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotAudioClassificationPipeline._call() : <code> ZeroShotAudioClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotaudioclassificationpipelinecall--code-zeroshotaudioclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.AutomaticSpeechRecognitionPipeline&quot;,&quot;local&quot;:&quot;pipelinesautomaticspeechrecognitionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new AutomaticSpeechRecognitionPipeline(options)&quot;,&quot;local&quot;:&quot;new-automaticspeechrecognitionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;automaticSpeechRecognitionPipeline._call() : <code> AutomaticSpeechRecognitionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;automaticspeechrecognitionpipelinecall--code-automaticspeechrecognitionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageToTextPipeline&quot;,&quot;local&quot;:&quot;pipelinesimagetotextpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageToTextPipeline(options)&quot;,&quot;local&quot;:&quot;new-imagetotextpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageToTextPipeline._call() : <code> ImageToTextPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagetotextpipelinecall--code-imagetotextpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinesimageclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-imageclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageClassificationPipeline._call() : <code> ImageClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imageclassificationpipelinecall--code-imageclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageSegmentationPipeline&quot;,&quot;local&quot;:&quot;pipelinesimagesegmentationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageSegmentationPipeline(options)&quot;,&quot;local&quot;:&quot;new-imagesegmentationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageSegmentationPipeline._call() : <code> ImageSegmentationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagesegmentationpipelinecall--code-imagesegmentationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotImageClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotimageclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotImageClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotimageclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotImageClassificationPipeline._call() : <code> ZeroShotImageClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotimageclassificationpipelinecall--code-zeroshotimageclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ObjectDetectionPipeline&quot;,&quot;local&quot;:&quot;pipelinesobjectdetectionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ObjectDetectionPipeline(options)&quot;,&quot;local&quot;:&quot;new-objectdetectionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;objectDetectionPipeline._call() : <code> ObjectDetectionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;objectdetectionpipelinecall--code-objectdetectionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotObjectDetectionPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotobjectdetectionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotObjectDetectionPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotobjectdetectionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotObjectDetectionPipeline._call() : <code> ZeroShotObjectDetectionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotobjectdetectionpipelinecall--code-zeroshotobjectdetectionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.DocumentQuestionAnsweringPipeline&quot;,&quot;local&quot;:&quot;pipelinesdocumentquestionansweringpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new DocumentQuestionAnsweringPipeline(options)&quot;,&quot;local&quot;:&quot;new-documentquestionansweringpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;documentQuestionAnsweringPipeline._call() : <code> DocumentQuestionAnsweringPipelineCallback </code>&quot;,&quot;local&quot;:&quot;documentquestionansweringpipelinecall--code-documentquestionansweringpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TextToAudioPipeline&quot;,&quot;local&quot;:&quot;pipelinestexttoaudiopipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TextToAudioPipeline(options)&quot;,&quot;local&quot;:&quot;new-texttoaudiopipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;textToAudioPipeline._call() : <code> TextToAudioPipelineCallback </code>&quot;,&quot;local&quot;:&quot;texttoaudiopipelinecall--code-texttoaudiopipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageToImagePipeline&quot;,&quot;local&quot;:&quot;pipelinesimagetoimagepipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageToImagePipeline(options)&quot;,&quot;local&quot;:&quot;new-imagetoimagepipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageToImagePipeline._call() : <code> ImageToImagePipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagetoimagepipelinecall--code-imagetoimagepipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.DepthEstimationPipeline&quot;,&quot;local&quot;:&quot;pipelinesdepthestimationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new DepthEstimationPipeline(options)&quot;,&quot;local&quot;:&quot;new-depthestimationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;depthEstimationPipeline._call() : <code> DepthEstimationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;depthestimationpipelinecall--code-depthestimationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.pipeline(task, [model], [options]) ⇒ <code> * </code>&quot;,&quot;local&quot;:&quot;pipelinespipelinetask-model-options--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImagePipelineInputs : <code> string </code> | <code> RawImage </code> | <code> URL </code>&quot;,&quot;local&quot;:&quot;pipelinesimagepipelineinputs--code-string-code--code-rawimage-code--code-url-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AudioPipelineInputs : <code> string </code> | <code> URL </code> | <code> Float32Array </code> | <code> Float64Array </code>&quot;,&quot;local&quot;:&quot;pipelinesaudiopipelineinputs--code-string-code--code-url-code--code-float32array-code--code-float64array-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~BoundingBox : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinesboundingbox--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~Disposable ⇒ <code> Promise. < void > </code>&quot;,&quot;local&quot;:&quot;pipelinesdisposable--code-promise--void--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextPipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinestextpipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImagePipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinesimagepipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextImagePipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinestextimagepipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextClassificationPipelineType ⇒ <code> Promise. < (TextClassificationOutput|Array < TextClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestextclassificationpipelinetype--code-promise--textclassificationoutputarray--textclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TokenClassificationPipelineType ⇒ <code> Promise. < (TokenClassificationOutput|Array < TokenClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestokenclassificationpipelinetype--code-promise--tokenclassificationoutputarray--tokenclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~QuestionAnsweringPipelineType ⇒ <code> Promise. < (QuestionAnsweringOutput|Array < QuestionAnsweringOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesquestionansweringpipelinetype--code-promise--questionansweringoutputarray--questionansweringoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~FillMaskPipelineType ⇒ <code> Promise. < (FillMaskOutput|Array < FillMaskOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesfillmaskpipelinetype--code-promise--fillmaskoutputarray--fillmaskoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~Text2TextGenerationPipelineType ⇒ <code> Promise. < (Text2TextGenerationOutput|Array < Text2TextGenerationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestext2textgenerationpipelinetype--code-promise--text2textgenerationoutputarray--text2textgenerationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~SummarizationPipelineType ⇒ <code> Promise. < (SummarizationOutput|Array < SummarizationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinessummarizationpipelinetype--code-promise--summarizationoutputarray--summarizationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TranslationPipelineType ⇒ <code> Promise. < (TranslationOutput|Array < TranslationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestranslationpipelinetype--code-promise--translationoutputarray--translationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextGenerationPipelineType ⇒ <code> Promise. < (TextGenerationOutput|Array < TextGenerationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestextgenerationpipelinetype--code-promise--textgenerationoutputarray--textgenerationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotClassificationPipelineType ⇒ <code> Promise. < (ZeroShotClassificationOutput|Array < ZeroShotClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotclassificationpipelinetype--code-promise--zeroshotclassificationoutputarray--zeroshotclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~FeatureExtractionPipelineType ⇒ <code> Promise. < Tensor > </code>&quot;,&quot;local&quot;:&quot;pipelinesfeatureextractionpipelinetype--code-promise--tensor--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageFeatureExtractionPipelineType ⇒ <code> Promise. < Tensor > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagefeatureextractionpipelinetype--code-promise--tensor--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AudioClassificationPipelineType ⇒ <code> Promise. < (AudioClassificationOutput|Array < AudioClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesaudioclassificationpipelinetype--code-promise--audioclassificationoutputarray--audioclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotAudioClassificationPipelineType ⇒ <code> Promise. < (Array < ZeroShotAudioClassificationOutput > |Array < Array < ZeroShotAudioClassificationOutput > > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotaudioclassificationpipelinetype--code-promise--array--zeroshotaudioclassificationoutput--array--array--zeroshotaudioclassificationoutput-----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~Chunk : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelineschunk--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AutomaticSpeechRecognitionPipelineType ⇒ <code> Promise. < (AutomaticSpeechRecognitionOutput|Array < AutomaticSpeechRecognitionOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesautomaticspeechrecognitionpipelinetype--code-promise--automaticspeechrecognitionoutputarray--automaticspeechrecognitionoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageToTextPipelineType ⇒ <code> Promise. < (ImageToTextOutput|Array < ImageToTextOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagetotextpipelinetype--code-promise--imagetotextoutputarray--imagetotextoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageClassificationPipelineType ⇒ <code> Promise. < (ImageClassificationOutput|Array < ImageClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesimageclassificationpipelinetype--code-promise--imageclassificationoutputarray--imageclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageSegmentationPipelineType ⇒ <code> Promise. < Array < ImageSegmentationPipelineOutput > > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagesegmentationpipelinetype--code-promise--array--imagesegmentationpipelineoutput---code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotImageClassificationPipelineType ⇒ <code> Promise. < (Array < ZeroShotImageClassificationOutput > |Array < Array < ZeroShotImageClassificationOutput > > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotimageclassificationpipelinetype--code-promise--array--zeroshotimageclassificationoutput--array--array--zeroshotimageclassificationoutput-----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ObjectDetectionPipelineType ⇒ <code> Promise. < (ObjectDetectionPipelineOutput|Array < ObjectDetectionPipelineOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesobjectdetectionpipelinetype--code-promise--objectdetectionpipelineoutputarray--objectdetectionpipelineoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotObjectDetectionPipelineType ⇒ <code> Promise. < (Array < ZeroShotObjectDetectionOutput > |Array < Array < ZeroShotObjectDetectionOutput > > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotobjectdetectionpipelinetype--code-promise--array--zeroshotobjectdetectionoutput--array--array--zeroshotobjectdetectionoutput-----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~DocumentQuestionAnsweringPipelineType ⇒ <code> Promise. < (DocumentQuestionAnsweringOutput|Array < DocumentQuestionAnsweringOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesdocumentquestionansweringpipelinetype--code-promise--documentquestionansweringoutputarray--documentquestionansweringoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextToAudioPipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinestexttoaudiopipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextToAudioPipelineType ⇒ <code> Promise. < TextToAudioOutput > </code>&quot;,&quot;local&quot;:&quot;pipelinestexttoaudiopipelinetype--code-promise--texttoaudiooutput--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageToImagePipelineType ⇒ <code> Promise. < (RawImage|Array < RawImage > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagetoimagepipelinetype--code-promise--rawimagearray--rawimage----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~DepthEstimationPipelineType ⇒ <code> Promise. < (DepthEstimationPipelineOutput|Array < DepthEstimationPipelineOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesdepthestimationpipelinetype--code-promise--depthestimationpipelineoutputarray--depthestimationpipelineoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AllTasks : <code> * </code>&quot;,&quot;local&quot;:&quot;pipelinesalltasks--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}">
<link href="/docs/transformers.js/pr_1113/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/entry/start.88a6e140.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/scheduler.0219f8bd.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/singletons.c59c6d8d.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/paths.8e090985.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/entry/app.0003020d.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/index.f61edf3b.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/nodes/0.25c65ab2.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/nodes/12.5fe58804.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/CodeBlock.38e566ae.js">
<link rel="modulepreload" href="/docs/transformers.js/pr_1113/en/_app/immutable/chunks/EditOnGithub.48fa589f.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;pipelines&quot;,&quot;local&quot;:&quot;pipelines&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;pipelines.Pipeline&quot;,&quot;local&quot;:&quot;pipelinespipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new Pipeline(options)&quot;,&quot;local&quot;:&quot;new-pipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;pipeline.dispose() : <code> DisposeType </code>&quot;,&quot;local&quot;:&quot;pipelinedispose--code-disposetype-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TextClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinestextclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TextClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-textclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;textClassificationPipeline._call() : <code> TextClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;textclassificationpipelinecall--code-textclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TokenClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinestokenclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TokenClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-tokenclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;tokenClassificationPipeline._call() : <code> TokenClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;tokenclassificationpipelinecall--code-tokenclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.QuestionAnsweringPipeline&quot;,&quot;local&quot;:&quot;pipelinesquestionansweringpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new QuestionAnsweringPipeline(options)&quot;,&quot;local&quot;:&quot;new-questionansweringpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;questionAnsweringPipeline._call() : <code> QuestionAnsweringPipelineCallback </code>&quot;,&quot;local&quot;:&quot;questionansweringpipelinecall--code-questionansweringpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.FillMaskPipeline&quot;,&quot;local&quot;:&quot;pipelinesfillmaskpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new FillMaskPipeline(options)&quot;,&quot;local&quot;:&quot;new-fillmaskpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;fillMaskPipeline._call() : <code> FillMaskPipelineCallback </code>&quot;,&quot;local&quot;:&quot;fillmaskpipelinecall--code-fillmaskpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.Text2TextGenerationPipeline&quot;,&quot;local&quot;:&quot;pipelinestext2textgenerationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new Text2TextGenerationPipeline(options)&quot;,&quot;local&quot;:&quot;new-text2textgenerationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;text2TextGenerationPipeline._key : <code> ’ generated_text ’ </code>&quot;,&quot;local&quot;:&quot;text2textgenerationpipelinekey--code--generatedtext--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;text2TextGenerationPipeline._call() : <code> Text2TextGenerationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;text2textgenerationpipelinecall--code-text2textgenerationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.SummarizationPipeline&quot;,&quot;local&quot;:&quot;pipelinessummarizationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new SummarizationPipeline(options)&quot;,&quot;local&quot;:&quot;new-summarizationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;summarizationPipeline._key : <code> ’ summary_text ’ </code>&quot;,&quot;local&quot;:&quot;summarizationpipelinekey--code--summarytext--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TranslationPipeline&quot;,&quot;local&quot;:&quot;pipelinestranslationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TranslationPipeline(options)&quot;,&quot;local&quot;:&quot;new-translationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;translationPipeline._key : <code> ’ translation_text ’ </code>&quot;,&quot;local&quot;:&quot;translationpipelinekey--code--translationtext--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TextGenerationPipeline&quot;,&quot;local&quot;:&quot;pipelinestextgenerationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TextGenerationPipeline(options)&quot;,&quot;local&quot;:&quot;new-textgenerationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;textGenerationPipeline._call() : <code> TextGenerationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;textgenerationpipelinecall--code-textgenerationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotClassificationPipeline.model : <code> any </code>&quot;,&quot;local&quot;:&quot;zeroshotclassificationpipelinemodel--code-any-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotClassificationPipeline._call() : <code> ZeroShotClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotclassificationpipelinecall--code-zeroshotclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.FeatureExtractionPipeline&quot;,&quot;local&quot;:&quot;pipelinesfeatureextractionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new FeatureExtractionPipeline(options)&quot;,&quot;local&quot;:&quot;new-featureextractionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;featureExtractionPipeline._call() : <code> FeatureExtractionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;featureextractionpipelinecall--code-featureextractionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageFeatureExtractionPipeline&quot;,&quot;local&quot;:&quot;pipelinesimagefeatureextractionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageFeatureExtractionPipeline(options)&quot;,&quot;local&quot;:&quot;new-imagefeatureextractionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageFeatureExtractionPipeline._call() : <code> ImageFeatureExtractionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagefeatureextractionpipelinecall--code-imagefeatureextractionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.AudioClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinesaudioclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new AudioClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-audioclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;audioClassificationPipeline._call() : <code> AudioClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;audioclassificationpipelinecall--code-audioclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotAudioClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotaudioclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotAudioClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotaudioclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotAudioClassificationPipeline._call() : <code> ZeroShotAudioClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotaudioclassificationpipelinecall--code-zeroshotaudioclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.AutomaticSpeechRecognitionPipeline&quot;,&quot;local&quot;:&quot;pipelinesautomaticspeechrecognitionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new AutomaticSpeechRecognitionPipeline(options)&quot;,&quot;local&quot;:&quot;new-automaticspeechrecognitionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;automaticSpeechRecognitionPipeline._call() : <code> AutomaticSpeechRecognitionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;automaticspeechrecognitionpipelinecall--code-automaticspeechrecognitionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageToTextPipeline&quot;,&quot;local&quot;:&quot;pipelinesimagetotextpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageToTextPipeline(options)&quot;,&quot;local&quot;:&quot;new-imagetotextpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageToTextPipeline._call() : <code> ImageToTextPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagetotextpipelinecall--code-imagetotextpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelinesimageclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-imageclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageClassificationPipeline._call() : <code> ImageClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imageclassificationpipelinecall--code-imageclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageSegmentationPipeline&quot;,&quot;local&quot;:&quot;pipelinesimagesegmentationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageSegmentationPipeline(options)&quot;,&quot;local&quot;:&quot;new-imagesegmentationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageSegmentationPipeline._call() : <code> ImageSegmentationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagesegmentationpipelinecall--code-imagesegmentationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotImageClassificationPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotimageclassificationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotImageClassificationPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotimageclassificationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotImageClassificationPipeline._call() : <code> ZeroShotImageClassificationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotimageclassificationpipelinecall--code-zeroshotimageclassificationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ObjectDetectionPipeline&quot;,&quot;local&quot;:&quot;pipelinesobjectdetectionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ObjectDetectionPipeline(options)&quot;,&quot;local&quot;:&quot;new-objectdetectionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;objectDetectionPipeline._call() : <code> ObjectDetectionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;objectdetectionpipelinecall--code-objectdetectionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ZeroShotObjectDetectionPipeline&quot;,&quot;local&quot;:&quot;pipelineszeroshotobjectdetectionpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ZeroShotObjectDetectionPipeline(options)&quot;,&quot;local&quot;:&quot;new-zeroshotobjectdetectionpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;zeroShotObjectDetectionPipeline._call() : <code> ZeroShotObjectDetectionPipelineCallback </code>&quot;,&quot;local&quot;:&quot;zeroshotobjectdetectionpipelinecall--code-zeroshotobjectdetectionpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.DocumentQuestionAnsweringPipeline&quot;,&quot;local&quot;:&quot;pipelinesdocumentquestionansweringpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new DocumentQuestionAnsweringPipeline(options)&quot;,&quot;local&quot;:&quot;new-documentquestionansweringpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;documentQuestionAnsweringPipeline._call() : <code> DocumentQuestionAnsweringPipelineCallback </code>&quot;,&quot;local&quot;:&quot;documentquestionansweringpipelinecall--code-documentquestionansweringpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.TextToAudioPipeline&quot;,&quot;local&quot;:&quot;pipelinestexttoaudiopipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new TextToAudioPipeline(options)&quot;,&quot;local&quot;:&quot;new-texttoaudiopipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;textToAudioPipeline._call() : <code> TextToAudioPipelineCallback </code>&quot;,&quot;local&quot;:&quot;texttoaudiopipelinecall--code-texttoaudiopipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.ImageToImagePipeline&quot;,&quot;local&quot;:&quot;pipelinesimagetoimagepipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new ImageToImagePipeline(options)&quot;,&quot;local&quot;:&quot;new-imagetoimagepipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;imageToImagePipeline._call() : <code> ImageToImagePipelineCallback </code>&quot;,&quot;local&quot;:&quot;imagetoimagepipelinecall--code-imagetoimagepipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.DepthEstimationPipeline&quot;,&quot;local&quot;:&quot;pipelinesdepthestimationpipeline&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;new DepthEstimationPipeline(options)&quot;,&quot;local&quot;:&quot;new-depthestimationpipelineoptions&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;depthEstimationPipeline._call() : <code> DepthEstimationPipelineCallback </code>&quot;,&quot;local&quot;:&quot;depthestimationpipelinecall--code-depthestimationpipelinecallback-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines.pipeline(task, [model], [options]) ⇒ <code> * </code>&quot;,&quot;local&quot;:&quot;pipelinespipelinetask-model-options--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImagePipelineInputs : <code> string </code> | <code> RawImage </code> | <code> URL </code>&quot;,&quot;local&quot;:&quot;pipelinesimagepipelineinputs--code-string-code--code-rawimage-code--code-url-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AudioPipelineInputs : <code> string </code> | <code> URL </code> | <code> Float32Array </code> | <code> Float64Array </code>&quot;,&quot;local&quot;:&quot;pipelinesaudiopipelineinputs--code-string-code--code-url-code--code-float32array-code--code-float64array-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~BoundingBox : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinesboundingbox--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~Disposable ⇒ <code> Promise. < void > </code>&quot;,&quot;local&quot;:&quot;pipelinesdisposable--code-promise--void--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextPipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinestextpipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImagePipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinesimagepipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextImagePipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinestextimagepipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextClassificationPipelineType ⇒ <code> Promise. < (TextClassificationOutput|Array < TextClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestextclassificationpipelinetype--code-promise--textclassificationoutputarray--textclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TokenClassificationPipelineType ⇒ <code> Promise. < (TokenClassificationOutput|Array < TokenClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestokenclassificationpipelinetype--code-promise--tokenclassificationoutputarray--tokenclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~QuestionAnsweringPipelineType ⇒ <code> Promise. < (QuestionAnsweringOutput|Array < QuestionAnsweringOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesquestionansweringpipelinetype--code-promise--questionansweringoutputarray--questionansweringoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~FillMaskPipelineType ⇒ <code> Promise. < (FillMaskOutput|Array < FillMaskOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesfillmaskpipelinetype--code-promise--fillmaskoutputarray--fillmaskoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~Text2TextGenerationPipelineType ⇒ <code> Promise. < (Text2TextGenerationOutput|Array < Text2TextGenerationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestext2textgenerationpipelinetype--code-promise--text2textgenerationoutputarray--text2textgenerationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~SummarizationPipelineType ⇒ <code> Promise. < (SummarizationOutput|Array < SummarizationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinessummarizationpipelinetype--code-promise--summarizationoutputarray--summarizationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TranslationPipelineType ⇒ <code> Promise. < (TranslationOutput|Array < TranslationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestranslationpipelinetype--code-promise--translationoutputarray--translationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextGenerationPipelineType ⇒ <code> Promise. < (TextGenerationOutput|Array < TextGenerationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinestextgenerationpipelinetype--code-promise--textgenerationoutputarray--textgenerationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotClassificationPipelineType ⇒ <code> Promise. < (ZeroShotClassificationOutput|Array < ZeroShotClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotclassificationpipelinetype--code-promise--zeroshotclassificationoutputarray--zeroshotclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~FeatureExtractionPipelineType ⇒ <code> Promise. < Tensor > </code>&quot;,&quot;local&quot;:&quot;pipelinesfeatureextractionpipelinetype--code-promise--tensor--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageFeatureExtractionPipelineType ⇒ <code> Promise. < Tensor > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagefeatureextractionpipelinetype--code-promise--tensor--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AudioClassificationPipelineType ⇒ <code> Promise. < (AudioClassificationOutput|Array < AudioClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesaudioclassificationpipelinetype--code-promise--audioclassificationoutputarray--audioclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotAudioClassificationPipelineType ⇒ <code> Promise. < (Array < ZeroShotAudioClassificationOutput > |Array < Array < ZeroShotAudioClassificationOutput > > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotaudioclassificationpipelinetype--code-promise--array--zeroshotaudioclassificationoutput--array--array--zeroshotaudioclassificationoutput-----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~Chunk : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelineschunk--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AutomaticSpeechRecognitionPipelineType ⇒ <code> Promise. < (AutomaticSpeechRecognitionOutput|Array < AutomaticSpeechRecognitionOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesautomaticspeechrecognitionpipelinetype--code-promise--automaticspeechrecognitionoutputarray--automaticspeechrecognitionoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageToTextPipelineType ⇒ <code> Promise. < (ImageToTextOutput|Array < ImageToTextOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagetotextpipelinetype--code-promise--imagetotextoutputarray--imagetotextoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageClassificationPipelineType ⇒ <code> Promise. < (ImageClassificationOutput|Array < ImageClassificationOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesimageclassificationpipelinetype--code-promise--imageclassificationoutputarray--imageclassificationoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageSegmentationPipelineType ⇒ <code> Promise. < Array < ImageSegmentationPipelineOutput > > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagesegmentationpipelinetype--code-promise--array--imagesegmentationpipelineoutput---code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotImageClassificationPipelineType ⇒ <code> Promise. < (Array < ZeroShotImageClassificationOutput > |Array < Array < ZeroShotImageClassificationOutput > > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotimageclassificationpipelinetype--code-promise--array--zeroshotimageclassificationoutput--array--array--zeroshotimageclassificationoutput-----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ObjectDetectionPipelineType ⇒ <code> Promise. < (ObjectDetectionPipelineOutput|Array < ObjectDetectionPipelineOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesobjectdetectionpipelinetype--code-promise--objectdetectionpipelineoutputarray--objectdetectionpipelineoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ZeroShotObjectDetectionPipelineType ⇒ <code> Promise. < (Array < ZeroShotObjectDetectionOutput > |Array < Array < ZeroShotObjectDetectionOutput > > ) > </code>&quot;,&quot;local&quot;:&quot;pipelineszeroshotobjectdetectionpipelinetype--code-promise--array--zeroshotobjectdetectionoutput--array--array--zeroshotobjectdetectionoutput-----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~DocumentQuestionAnsweringPipelineType ⇒ <code> Promise. < (DocumentQuestionAnsweringOutput|Array < DocumentQuestionAnsweringOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesdocumentquestionansweringpipelinetype--code-promise--documentquestionansweringoutputarray--documentquestionansweringoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextToAudioPipelineConstructorArgs : <code> Object </code>&quot;,&quot;local&quot;:&quot;pipelinestexttoaudiopipelineconstructorargs--code-object-code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~TextToAudioPipelineType ⇒ <code> Promise. < TextToAudioOutput > </code>&quot;,&quot;local&quot;:&quot;pipelinestexttoaudiopipelinetype--code-promise--texttoaudiooutput--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~ImageToImagePipelineType ⇒ <code> Promise. < (RawImage|Array < RawImage > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesimagetoimagepipelinetype--code-promise--rawimagearray--rawimage----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~DepthEstimationPipelineType ⇒ <code> Promise. < (DepthEstimationPipelineOutput|Array < DepthEstimationPipelineOutput > ) > </code>&quot;,&quot;local&quot;:&quot;pipelinesdepthestimationpipelinetype--code-promise--depthestimationpipelineoutputarray--depthestimationpipelineoutput----code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;pipelines~AllTasks : <code> * </code>&quot;,&quot;local&quot;:&quot;pipelinesalltasks--code--code&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <a id="module_pipelines" class="group"></a> <h1 class="relative group"><a id="pipelines" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelines"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines</span></h1> <p data-svelte-h="svelte-1inm2t9">Pipelines provide a high-level, easy to use, API for running machine learning models.</p> <p data-svelte-h="svelte-1pjech"><strong>Example:</strong> Instantiate pipeline using the <code>pipeline</code> function.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">import</span> { pipeline } <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@huggingface/transformers&#x27;</span>;
<span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;sentiment-analysis&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(<span class="hljs-string">&#x27;I love transformers!&#x27;</span>);
<span class="hljs-comment">// [{&#x27;label&#x27;: &#x27;POSITIVE&#x27;, &#x27;score&#x27;: 0.999817686}]</span><!-- HTML_TAG_END --></pre></div> <ul data-svelte-h="svelte-g9u9bb"><li><a href="#module_pipelines">pipelines</a><ul><li><em>static</em><ul><li><a href="#module_pipelines.Pipeline">.Pipeline</a><ul><li><a href="#new_module_pipelines.Pipeline_new"><code>new Pipeline(options)</code></a></li> <li><a href="#module_pipelines.Pipeline+dispose"><code>.dispose()</code></a> : <code>DisposeType</code></li></ul></li> <li><a href="#module_pipelines.TextClassificationPipeline">.TextClassificationPipeline</a><ul><li><a href="#new_module_pipelines.TextClassificationPipeline_new"><code>new TextClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TextClassificationPipeline+_call"><code>._call()</code></a> : <code>TextClassificationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.TokenClassificationPipeline">.TokenClassificationPipeline</a><ul><li><a href="#new_module_pipelines.TokenClassificationPipeline_new"><code>new TokenClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TokenClassificationPipeline+_call"><code>._call()</code></a> : <code>TokenClassificationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.QuestionAnsweringPipeline">.QuestionAnsweringPipeline</a><ul><li><a href="#new_module_pipelines.QuestionAnsweringPipeline_new"><code>new QuestionAnsweringPipeline(options)</code></a></li> <li><a href="#module_pipelines.QuestionAnsweringPipeline+_call"><code>._call()</code></a> : <code>QuestionAnsweringPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.FillMaskPipeline">.FillMaskPipeline</a><ul><li><a href="#new_module_pipelines.FillMaskPipeline_new"><code>new FillMaskPipeline(options)</code></a></li> <li><a href="#module_pipelines.FillMaskPipeline+_call"><code>._call()</code></a> : <code>FillMaskPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.Text2TextGenerationPipeline">.Text2TextGenerationPipeline</a><ul><li><a href="#new_module_pipelines.Text2TextGenerationPipeline_new"><code>new Text2TextGenerationPipeline(options)</code></a></li> <li><a href="#module_pipelines.Text2TextGenerationPipeline+_key"><code>._key</code></a> : <code>’generated_text’</code></li> <li><a href="#module_pipelines.Text2TextGenerationPipeline+_call"><code>._call()</code></a> : <code>Text2TextGenerationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.SummarizationPipeline">.SummarizationPipeline</a><ul><li><a href="#new_module_pipelines.SummarizationPipeline_new"><code>new SummarizationPipeline(options)</code></a></li> <li><a href="#module_pipelines.SummarizationPipeline+_key"><code>._key</code></a> : <code>’summary_text’</code></li></ul></li> <li><a href="#module_pipelines.TranslationPipeline">.TranslationPipeline</a><ul><li><a href="#new_module_pipelines.TranslationPipeline_new"><code>new TranslationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TranslationPipeline+_key"><code>._key</code></a> : <code>’translation_text’</code></li></ul></li> <li><a href="#module_pipelines.TextGenerationPipeline">.TextGenerationPipeline</a><ul><li><a href="#new_module_pipelines.TextGenerationPipeline_new"><code>new TextGenerationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TextGenerationPipeline+_call"><code>._call()</code></a> : <code>TextGenerationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ZeroShotClassificationPipeline">.ZeroShotClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotClassificationPipeline_new"><code>new ZeroShotClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotClassificationPipeline+model"><code>.model</code></a> : <code>any</code></li> <li><a href="#module_pipelines.ZeroShotClassificationPipeline+_call"><code>._call()</code></a> : <code>ZeroShotClassificationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.FeatureExtractionPipeline">.FeatureExtractionPipeline</a><ul><li><a href="#new_module_pipelines.FeatureExtractionPipeline_new"><code>new FeatureExtractionPipeline(options)</code></a></li> <li><a href="#module_pipelines.FeatureExtractionPipeline+_call"><code>._call()</code></a> : <code>FeatureExtractionPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ImageFeatureExtractionPipeline">.ImageFeatureExtractionPipeline</a><ul><li><a href="#new_module_pipelines.ImageFeatureExtractionPipeline_new"><code>new ImageFeatureExtractionPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageFeatureExtractionPipeline+_call"><code>._call()</code></a> : <code>ImageFeatureExtractionPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.AudioClassificationPipeline">.AudioClassificationPipeline</a><ul><li><a href="#new_module_pipelines.AudioClassificationPipeline_new"><code>new AudioClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.AudioClassificationPipeline+_call"><code>._call()</code></a> : <code>AudioClassificationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ZeroShotAudioClassificationPipeline">.ZeroShotAudioClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotAudioClassificationPipeline_new"><code>new ZeroShotAudioClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotAudioClassificationPipeline+_call"><code>._call()</code></a> : <code>ZeroShotAudioClassificationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.AutomaticSpeechRecognitionPipeline">.AutomaticSpeechRecognitionPipeline</a><ul><li><a href="#new_module_pipelines.AutomaticSpeechRecognitionPipeline_new"><code>new AutomaticSpeechRecognitionPipeline(options)</code></a></li> <li><a href="#module_pipelines.AutomaticSpeechRecognitionPipeline+_call"><code>._call()</code></a> : <code>AutomaticSpeechRecognitionPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ImageToTextPipeline">.ImageToTextPipeline</a><ul><li><a href="#new_module_pipelines.ImageToTextPipeline_new"><code>new ImageToTextPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageToTextPipeline+_call"><code>._call()</code></a> : <code>ImageToTextPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ImageClassificationPipeline">.ImageClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ImageClassificationPipeline_new"><code>new ImageClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageClassificationPipeline+_call"><code>._call()</code></a> : <code>ImageClassificationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ImageSegmentationPipeline">.ImageSegmentationPipeline</a><ul><li><a href="#new_module_pipelines.ImageSegmentationPipeline_new"><code>new ImageSegmentationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageSegmentationPipeline+_call"><code>._call()</code></a> : <code>ImageSegmentationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ZeroShotImageClassificationPipeline">.ZeroShotImageClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotImageClassificationPipeline_new"><code>new ZeroShotImageClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotImageClassificationPipeline+_call"><code>._call()</code></a> : <code>ZeroShotImageClassificationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ObjectDetectionPipeline">.ObjectDetectionPipeline</a><ul><li><a href="#new_module_pipelines.ObjectDetectionPipeline_new"><code>new ObjectDetectionPipeline(options)</code></a></li> <li><a href="#module_pipelines.ObjectDetectionPipeline+_call"><code>._call()</code></a> : <code>ObjectDetectionPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ZeroShotObjectDetectionPipeline">.ZeroShotObjectDetectionPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotObjectDetectionPipeline_new"><code>new ZeroShotObjectDetectionPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotObjectDetectionPipeline+_call"><code>._call()</code></a> : <code>ZeroShotObjectDetectionPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.DocumentQuestionAnsweringPipeline">.DocumentQuestionAnsweringPipeline</a><ul><li><a href="#new_module_pipelines.DocumentQuestionAnsweringPipeline_new"><code>new DocumentQuestionAnsweringPipeline(options)</code></a></li> <li><a href="#module_pipelines.DocumentQuestionAnsweringPipeline+_call"><code>._call()</code></a> : <code>DocumentQuestionAnsweringPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.TextToAudioPipeline">.TextToAudioPipeline</a><ul><li><a href="#new_module_pipelines.TextToAudioPipeline_new"><code>new TextToAudioPipeline(options)</code></a></li> <li><a href="#module_pipelines.TextToAudioPipeline+_call"><code>._call()</code></a> : <code>TextToAudioPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.ImageToImagePipeline">.ImageToImagePipeline</a><ul><li><a href="#new_module_pipelines.ImageToImagePipeline_new"><code>new ImageToImagePipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageToImagePipeline+_call"><code>._call()</code></a> : <code>ImageToImagePipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.DepthEstimationPipeline">.DepthEstimationPipeline</a><ul><li><a href="#new_module_pipelines.DepthEstimationPipeline_new"><code>new DepthEstimationPipeline(options)</code></a></li> <li><a href="#module_pipelines.DepthEstimationPipeline+_call"><code>._call()</code></a> : <code>DepthEstimationPipelineCallback</code></li></ul></li> <li><a href="#module_pipelines.pipeline"><code>.pipeline(task, [model], [options])</code></a><code>*</code></li></ul></li> <li><em>inner</em><ul><li><a href="#module_pipelines..ImagePipelineInputs"><code>~ImagePipelineInputs</code></a> : <code>string</code> | <a href="#RawImage"><code>RawImage</code></a> | <code>URL</code></li> <li><a href="#module_pipelines..AudioPipelineInputs"><code>~AudioPipelineInputs</code></a> : <code>string</code> | <code>URL</code> | <code>Float32Array</code> | <code>Float64Array</code></li> <li><a href="#module_pipelines..BoundingBox"><code>~BoundingBox</code></a> : <code>Object</code></li> <li><a href="#module_pipelines..Disposable"><code>~Disposable</code></a><code>Promise.&lt;void&gt;</code></li> <li><a href="#module_pipelines..TextPipelineConstructorArgs"><code>~TextPipelineConstructorArgs</code></a> : <code>Object</code></li> <li><a href="#module_pipelines..ImagePipelineConstructorArgs"><code>~ImagePipelineConstructorArgs</code></a> : <code>Object</code></li> <li><a href="#module_pipelines..TextImagePipelineConstructorArgs"><code>~TextImagePipelineConstructorArgs</code></a> : <code>Object</code></li> <li><a href="#module_pipelines..TextClassificationPipelineType"><code>~TextClassificationPipelineType</code></a><code>Promise.&lt;(TextClassificationOutput|Array&lt;TextClassificationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..TokenClassificationPipelineType"><code>~TokenClassificationPipelineType</code></a><code>Promise.&lt;(TokenClassificationOutput|Array&lt;TokenClassificationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..QuestionAnsweringPipelineType"><code>~QuestionAnsweringPipelineType</code></a><code>Promise.&lt;(QuestionAnsweringOutput|Array&lt;QuestionAnsweringOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..FillMaskPipelineType"><code>~FillMaskPipelineType</code></a><code>Promise.&lt;(FillMaskOutput|Array&lt;FillMaskOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..Text2TextGenerationPipelineType"><code>~Text2TextGenerationPipelineType</code></a><code>Promise.&lt;(Text2TextGenerationOutput|Array&lt;Text2TextGenerationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..SummarizationPipelineType"><code>~SummarizationPipelineType</code></a><code>Promise.&lt;(SummarizationOutput|Array&lt;SummarizationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..TranslationPipelineType"><code>~TranslationPipelineType</code></a><code>Promise.&lt;(TranslationOutput|Array&lt;TranslationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..TextGenerationPipelineType"><code>~TextGenerationPipelineType</code></a><code>Promise.&lt;(TextGenerationOutput|Array&lt;TextGenerationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..ZeroShotClassificationPipelineType"><code>~ZeroShotClassificationPipelineType</code></a><code>Promise.&lt;(ZeroShotClassificationOutput|Array&lt;ZeroShotClassificationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..FeatureExtractionPipelineType"><code>~FeatureExtractionPipelineType</code></a><a href="#Tensor"><code>Promise.&lt;Tensor&gt;</code></a></li> <li><a href="#module_pipelines..ImageFeatureExtractionPipelineType"><code>~ImageFeatureExtractionPipelineType</code></a><a href="#Tensor"><code>Promise.&lt;Tensor&gt;</code></a></li> <li><a href="#module_pipelines..AudioClassificationPipelineType"><code>~AudioClassificationPipelineType</code></a><code>Promise.&lt;(AudioClassificationOutput|Array&lt;AudioClassificationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..ZeroShotAudioClassificationPipelineType"><code>~ZeroShotAudioClassificationPipelineType</code></a><code>Promise.&lt;(Array&lt;ZeroShotAudioClassificationOutput&gt;|Array&lt;Array&lt;ZeroShotAudioClassificationOutput&gt;&gt;)&gt;</code></li> <li><a href="#module_pipelines..Chunk"><code>~Chunk</code></a> : <code>Object</code></li> <li><a href="#module_pipelines..AutomaticSpeechRecognitionPipelineType"><code>~AutomaticSpeechRecognitionPipelineType</code></a><code>Promise.&lt;(AutomaticSpeechRecognitionOutput|Array&lt;AutomaticSpeechRecognitionOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..ImageToTextPipelineType"><code>~ImageToTextPipelineType</code></a><code>Promise.&lt;(ImageToTextOutput|Array&lt;ImageToTextOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..ImageClassificationPipelineType"><code>~ImageClassificationPipelineType</code></a><code>Promise.&lt;(ImageClassificationOutput|Array&lt;ImageClassificationOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..ImageSegmentationPipelineType"><code>~ImageSegmentationPipelineType</code></a><code>Promise.&lt;Array&lt;ImageSegmentationPipelineOutput&gt;&gt;</code></li> <li><a href="#module_pipelines..ZeroShotImageClassificationPipelineType"><code>~ZeroShotImageClassificationPipelineType</code></a><code>Promise.&lt;(Array&lt;ZeroShotImageClassificationOutput&gt;|Array&lt;Array&lt;ZeroShotImageClassificationOutput&gt;&gt;)&gt;</code></li> <li><a href="#module_pipelines..ObjectDetectionPipelineType"><code>~ObjectDetectionPipelineType</code></a><code>Promise.&lt;(ObjectDetectionPipelineOutput|Array&lt;ObjectDetectionPipelineOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..ZeroShotObjectDetectionPipelineType"><code>~ZeroShotObjectDetectionPipelineType</code></a><code>Promise.&lt;(Array&lt;ZeroShotObjectDetectionOutput&gt;|Array&lt;Array&lt;ZeroShotObjectDetectionOutput&gt;&gt;)&gt;</code></li> <li><a href="#module_pipelines..DocumentQuestionAnsweringPipelineType"><code>~DocumentQuestionAnsweringPipelineType</code></a><code>Promise.&lt;(DocumentQuestionAnsweringOutput|Array&lt;DocumentQuestionAnsweringOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..TextToAudioPipelineConstructorArgs"><code>~TextToAudioPipelineConstructorArgs</code></a> : <code>Object</code></li> <li><a href="#module_pipelines..TextToAudioPipelineType"><code>~TextToAudioPipelineType</code></a><code>Promise.&lt;TextToAudioOutput&gt;</code></li> <li><a href="#module_pipelines..ImageToImagePipelineType"><code>~ImageToImagePipelineType</code></a><code>Promise.&lt;(RawImage|Array&lt;RawImage&gt;)&gt;</code></li> <li><a href="#module_pipelines..DepthEstimationPipelineType"><code>~DepthEstimationPipelineType</code></a><code>Promise.&lt;(DepthEstimationPipelineOutput|Array&lt;DepthEstimationPipelineOutput&gt;)&gt;</code></li> <li><a href="#module_pipelines..AllTasks"><code>~AllTasks</code></a> : <code>*</code></li></ul></li></ul></li></ul> <hr> <a id="module_pipelines.Pipeline" class="group"></a> <h2 class="relative group"><a id="pipelinespipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinespipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.Pipeline</span></h2> <p data-svelte-h="svelte-16ix8v2">The Pipeline class is the class from which all pipelines inherit.
Refer to this class for methods shared across different pipelines.</p> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1va89g7"><li><a href="#module_pipelines.Pipeline">.Pipeline</a><ul><li><a href="#new_module_pipelines.Pipeline_new"><code>new Pipeline(options)</code></a></li> <li><a href="#module_pipelines.Pipeline+dispose"><code>.dispose()</code></a> : <code>DisposeType</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.Pipeline_new" class="group"></a> <h3 class="relative group"><a id="new-pipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-pipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new Pipeline(options)</span></h3> <p data-svelte-h="svelte-10jkwj">Create a new Pipeline.</p> <table data-svelte-h="svelte-z7lv5w"><thead><tr><th>Param</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>Object</code></td><td></td><td><p>An object containing the following properties:</p></td> </tr><tr><td>[options.task]</td><td><code>string</code></td><td></td><td><p>The task of the pipeline. Useful for specifying subtasks.</p></td> </tr><tr><td>[options.model]</td><td><code>PreTrainedModel</code></td><td></td><td><p>The model used by the pipeline.</p></td> </tr><tr><td>[options.tokenizer]</td><td><code>PreTrainedTokenizer</code></td><td><code></code></td><td><p>The tokenizer used by the pipeline (if any).</p></td> </tr><tr><td>[options.processor]</td><td><code>Processor</code></td><td><code></code></td><td><p>The processor used by the pipeline (if any).</p></td></tr></tbody></table> <hr> <a id="module_pipelines.Pipeline+dispose" class="group"></a> <h3 class="relative group"><a id="pipelinedispose--code-disposetype-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinedispose--code-disposetype-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipeline.dispose() : &lt;code> DisposeType &lt;/code></span></h3> <p data-svelte-h="svelte-hhwo7"><strong>Kind</strong>: instance method of <a href="#module_pipelines.Pipeline"><code>Pipeline</code></a></p> <hr> <a id="module_pipelines.TextClassificationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinestextclassificationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestextclassificationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.TextClassificationPipeline</span></h2> <p data-svelte-h="svelte-1aega0x">Text classification pipeline using any <code>ModelForSequenceClassification</code>.</p> <p data-svelte-h="svelte-twv4w2"><strong>Example:</strong> Sentiment-analysis w/ <code>Xenova/distilbert-base-uncased-finetuned-sst-2-english</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;sentiment-analysis&#x27;</span>, <span class="hljs-string">&#x27;Xenova/distilbert-base-uncased-finetuned-sst-2-english&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(<span class="hljs-string">&#x27;I love transformers!&#x27;</span>);
<span class="hljs-comment">// [{ label: &#x27;POSITIVE&#x27;, score: 0.999788761138916 }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-9l8wqs"><strong>Example:</strong> Multilingual sentiment-analysis w/ <code>Xenova/bert-base-multilingual-uncased-sentiment</code> (and return top 5 classes).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;sentiment-analysis&#x27;</span>, <span class="hljs-string">&#x27;Xenova/bert-base-multilingual-uncased-sentiment&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(<span class="hljs-string">&#x27;Le meilleur film de tous les temps.&#x27;</span>, { <span class="hljs-attr">top_k</span>: <span class="hljs-number">5</span> });
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;5 stars&#x27;, score: 0.9610759615898132 },</span>
<span class="hljs-comment">// { label: &#x27;4 stars&#x27;, score: 0.03323351591825485 },</span>
<span class="hljs-comment">// { label: &#x27;3 stars&#x27;, score: 0.0036155181005597115 },</span>
<span class="hljs-comment">// { label: &#x27;1 star&#x27;, score: 0.0011325967498123646 },</span>
<span class="hljs-comment">// { label: &#x27;2 stars&#x27;, score: 0.0009423971059732139 }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-63pkoo"><strong>Example:</strong> Toxic comment classification w/ <code>Xenova/toxic-bert</code> (and return all classes).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;text-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/toxic-bert&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(<span class="hljs-string">&#x27;I hate you!&#x27;</span>, { <span class="hljs-attr">top_k</span>: <span class="hljs-literal">null</span> });
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;toxic&#x27;, score: 0.9593140482902527 },</span>
<span class="hljs-comment">// { label: &#x27;insult&#x27;, score: 0.16187334060668945 },</span>
<span class="hljs-comment">// { label: &#x27;obscene&#x27;, score: 0.03452680632472038 },</span>
<span class="hljs-comment">// { label: &#x27;identity_hate&#x27;, score: 0.0223250575363636 },</span>
<span class="hljs-comment">// { label: &#x27;threat&#x27;, score: 0.019197041168808937 },</span>
<span class="hljs-comment">// { label: &#x27;severe_toxic&#x27;, score: 0.005651099607348442 }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-pm72j5"><li><a href="#module_pipelines.TextClassificationPipeline">.TextClassificationPipeline</a><ul><li><a href="#new_module_pipelines.TextClassificationPipeline_new"><code>new TextClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TextClassificationPipeline+_call"><code>._call()</code></a> : <code>TextClassificationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.TextClassificationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-textclassificationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-textclassificationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new TextClassificationPipeline(options)</span></h3> <p data-svelte-h="svelte-i7tdq8">Create a new TextClassificationPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.TextClassificationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="textclassificationpipelinecall--code-textclassificationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#textclassificationpipelinecall--code-textclassificationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>textClassificationPipeline._call() : &lt;code> TextClassificationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-10suosj"><strong>Kind</strong>: instance method of <a href="#module_pipelines.TextClassificationPipeline"><code>TextClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.TokenClassificationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinestokenclassificationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestokenclassificationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.TokenClassificationPipeline</span></h2> <p data-svelte-h="svelte-199l8oj">Named Entity Recognition pipeline using any <code>ModelForTokenClassification</code>.</p> <p data-svelte-h="svelte-3ojewp"><strong>Example:</strong> Perform named entity recognition with <code>Xenova/bert-base-NER</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;token-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/bert-base-NER&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(<span class="hljs-string">&#x27;My name is Sarah and I live in London&#x27;</span>);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { entity: &#x27;B-PER&#x27;, score: 0.9980202913284302, index: 4, word: &#x27;Sarah&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;B-LOC&#x27;, score: 0.9994474053382874, index: 9, word: &#x27;London&#x27; }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1ln7q61"><strong>Example:</strong> Perform named entity recognition with <code>Xenova/bert-base-NER</code> (and return all labels).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;token-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/bert-base-NER&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(<span class="hljs-string">&#x27;Sarah lives in the United States of America&#x27;</span>, { <span class="hljs-attr">ignore_labels</span>: [] });
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { entity: &#x27;B-PER&#x27;, score: 0.9966587424278259, index: 1, word: &#x27;Sarah&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;O&#x27;, score: 0.9987385869026184, index: 2, word: &#x27;lives&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;O&#x27;, score: 0.9990072846412659, index: 3, word: &#x27;in&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;O&#x27;, score: 0.9988298416137695, index: 4, word: &#x27;the&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;B-LOC&#x27;, score: 0.9995510578155518, index: 5, word: &#x27;United&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;I-LOC&#x27;, score: 0.9990395307540894, index: 6, word: &#x27;States&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;I-LOC&#x27;, score: 0.9986724853515625, index: 7, word: &#x27;of&#x27; },</span>
<span class="hljs-comment">// { entity: &#x27;I-LOC&#x27;, score: 0.9975294470787048, index: 8, word: &#x27;America&#x27; }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-m3wy8r"><li><a href="#module_pipelines.TokenClassificationPipeline">.TokenClassificationPipeline</a><ul><li><a href="#new_module_pipelines.TokenClassificationPipeline_new"><code>new TokenClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TokenClassificationPipeline+_call"><code>._call()</code></a> : <code>TokenClassificationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.TokenClassificationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-tokenclassificationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-tokenclassificationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new TokenClassificationPipeline(options)</span></h3> <p data-svelte-h="svelte-1qyf5iw">Create a new TokenClassificationPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.TokenClassificationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="tokenclassificationpipelinecall--code-tokenclassificationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#tokenclassificationpipelinecall--code-tokenclassificationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>tokenClassificationPipeline._call() : &lt;code> TokenClassificationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1fnwy8z"><strong>Kind</strong>: instance method of <a href="#module_pipelines.TokenClassificationPipeline"><code>TokenClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.QuestionAnsweringPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesquestionansweringpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesquestionansweringpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.QuestionAnsweringPipeline</span></h2> <p data-svelte-h="svelte-14f3xkz">Question Answering pipeline using any <code>ModelForQuestionAnswering</code>.</p> <p data-svelte-h="svelte-o2pgcr"><strong>Example:</strong> Run question answering with <code>Xenova/distilbert-base-uncased-distilled-squad</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> answerer = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;question-answering&#x27;</span>, <span class="hljs-string">&#x27;Xenova/distilbert-base-uncased-distilled-squad&#x27;</span>);
<span class="hljs-keyword">const</span> question = <span class="hljs-string">&#x27;Who was Jim Henson?&#x27;</span>;
<span class="hljs-keyword">const</span> context = <span class="hljs-string">&#x27;Jim Henson was a nice puppet.&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">answerer</span>(question, context);
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// answer: &quot;a nice puppet&quot;,</span>
<span class="hljs-comment">// score: 0.5768911502526741</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-ryq6lj"><li><a href="#module_pipelines.QuestionAnsweringPipeline">.QuestionAnsweringPipeline</a><ul><li><a href="#new_module_pipelines.QuestionAnsweringPipeline_new"><code>new QuestionAnsweringPipeline(options)</code></a></li> <li><a href="#module_pipelines.QuestionAnsweringPipeline+_call"><code>._call()</code></a> : <code>QuestionAnsweringPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.QuestionAnsweringPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-questionansweringpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-questionansweringpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new QuestionAnsweringPipeline(options)</span></h3> <p data-svelte-h="svelte-neuqt1">Create a new QuestionAnsweringPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.QuestionAnsweringPipeline+_call" class="group"></a> <h3 class="relative group"><a id="questionansweringpipelinecall--code-questionansweringpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#questionansweringpipelinecall--code-questionansweringpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>questionAnsweringPipeline._call() : &lt;code> QuestionAnsweringPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1xqr0u1"><strong>Kind</strong>: instance method of <a href="#module_pipelines.QuestionAnsweringPipeline"><code>QuestionAnsweringPipeline</code></a></p> <hr> <a id="module_pipelines.FillMaskPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesfillmaskpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesfillmaskpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.FillMaskPipeline</span></h2> <p data-svelte-h="svelte-nzjx48">Masked language modeling prediction pipeline using any <code>ModelWithLMHead</code>.</p> <p data-svelte-h="svelte-1xict4f"><strong>Example:</strong> Perform masked language modelling (a.k.a. “fill-mask”) with <code>Xenova/bert-base-uncased</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> unmasker = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;fill-mask&#x27;</span>, <span class="hljs-string">&#x27;Xenova/bert-base-cased&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">unmasker</span>(<span class="hljs-string">&#x27;The goal of life is [MASK].&#x27;</span>);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { token_str: &#x27;survival&#x27;, score: 0.06137419492006302, token: 8115, sequence: &#x27;The goal of life is survival.&#x27; },</span>
<span class="hljs-comment">// { token_str: &#x27;love&#x27;, score: 0.03902450203895569, token: 1567, sequence: &#x27;The goal of life is love.&#x27; },</span>
<span class="hljs-comment">// { token_str: &#x27;happiness&#x27;, score: 0.03253183513879776, token: 9266, sequence: &#x27;The goal of life is happiness.&#x27; },</span>
<span class="hljs-comment">// { token_str: &#x27;freedom&#x27;, score: 0.018736306577920914, token: 4438, sequence: &#x27;The goal of life is freedom.&#x27; },</span>
<span class="hljs-comment">// { token_str: &#x27;life&#x27;, score: 0.01859794743359089, token: 1297, sequence: &#x27;The goal of life is life.&#x27; }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1sz7ava"><strong>Example:</strong> Perform masked language modelling (a.k.a. “fill-mask”) with <code>Xenova/bert-base-cased</code> (and return top result).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> unmasker = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;fill-mask&#x27;</span>, <span class="hljs-string">&#x27;Xenova/bert-base-cased&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">unmasker</span>(<span class="hljs-string">&#x27;The Milky Way is a [MASK] galaxy.&#x27;</span>, { <span class="hljs-attr">top_k</span>: <span class="hljs-number">1</span> });
<span class="hljs-comment">// [{ token_str: &#x27;spiral&#x27;, score: 0.6299987435340881, token: 14061, sequence: &#x27;The Milky Way is a spiral galaxy.&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-13j9xod"><li><a href="#module_pipelines.FillMaskPipeline">.FillMaskPipeline</a><ul><li><a href="#new_module_pipelines.FillMaskPipeline_new"><code>new FillMaskPipeline(options)</code></a></li> <li><a href="#module_pipelines.FillMaskPipeline+_call"><code>._call()</code></a> : <code>FillMaskPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.FillMaskPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-fillmaskpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-fillmaskpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new FillMaskPipeline(options)</span></h3> <p data-svelte-h="svelte-1wfo17y">Create a new FillMaskPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.FillMaskPipeline+_call" class="group"></a> <h3 class="relative group"><a id="fillmaskpipelinecall--code-fillmaskpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#fillmaskpipelinecall--code-fillmaskpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>fillMaskPipeline._call() : &lt;code> FillMaskPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-nplbor"><strong>Kind</strong>: instance method of <a href="#module_pipelines.FillMaskPipeline"><code>FillMaskPipeline</code></a></p> <hr> <a id="module_pipelines.Text2TextGenerationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinestext2textgenerationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestext2textgenerationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.Text2TextGenerationPipeline</span></h2> <p data-svelte-h="svelte-e2spcq">Text2TextGenerationPipeline class for generating text using a model that performs text-to-text generation tasks.</p> <p data-svelte-h="svelte-j4hwgn"><strong>Example:</strong> Text-to-text generation w/ <code>Xenova/LaMini-Flan-T5-783M</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> generator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;text2text-generation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/LaMini-Flan-T5-783M&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generator</span>(<span class="hljs-string">&#x27;how can I become more healthy?&#x27;</span>, {
<span class="hljs-attr">max_new_tokens</span>: <span class="hljs-number">100</span>,
});
<span class="hljs-comment">// [{ generated_text: &quot;To become more healthy, you can: 1. Eat a balanced diet with plenty of fruits, vegetables, whole grains, lean proteins, and healthy fats. 2. Stay hydrated by drinking plenty of water. 3. Get enough sleep and manage stress levels. 4. Avoid smoking and excessive alcohol consumption. 5. Regularly exercise and maintain a healthy weight. 6. Practice good hygiene and sanitation. 7. Seek medical attention if you experience any health issues.&quot; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-11x3uau"><li><a href="#module_pipelines.Text2TextGenerationPipeline">.Text2TextGenerationPipeline</a><ul><li><a href="#new_module_pipelines.Text2TextGenerationPipeline_new"><code>new Text2TextGenerationPipeline(options)</code></a></li> <li><a href="#module_pipelines.Text2TextGenerationPipeline+_key"><code>._key</code></a> : <code>’generated_text’</code></li> <li><a href="#module_pipelines.Text2TextGenerationPipeline+_call"><code>._call()</code></a> : <code>Text2TextGenerationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.Text2TextGenerationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-text2textgenerationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-text2textgenerationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new Text2TextGenerationPipeline(options)</span></h3> <p data-svelte-h="svelte-1cz796d">Create a new Text2TextGenerationPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.Text2TextGenerationPipeline+_key" class="group"></a> <h3 class="relative group"><a id="text2textgenerationpipelinekey--code--generatedtext--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#text2textgenerationpipelinekey--code--generatedtext--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>text2TextGenerationPipeline._key : &lt;code> ’ generated_text ’ &lt;/code></span></h3> <p data-svelte-h="svelte-1k77yex"><strong>Kind</strong>: instance property of <a href="#module_pipelines.Text2TextGenerationPipeline"><code>Text2TextGenerationPipeline</code></a></p> <hr> <a id="module_pipelines.Text2TextGenerationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="text2textgenerationpipelinecall--code-text2textgenerationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#text2textgenerationpipelinecall--code-text2textgenerationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>text2TextGenerationPipeline._call() : &lt;code> Text2TextGenerationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1gl4q1t"><strong>Kind</strong>: instance method of <a href="#module_pipelines.Text2TextGenerationPipeline"><code>Text2TextGenerationPipeline</code></a></p> <hr> <a id="module_pipelines.SummarizationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinessummarizationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinessummarizationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.SummarizationPipeline</span></h2> <p data-svelte-h="svelte-1axdht2">A pipeline for summarization tasks, inheriting from Text2TextGenerationPipeline.</p> <p data-svelte-h="svelte-1416cqx"><strong>Example:</strong> Summarization w/ <code>Xenova/distilbart-cnn-6-6</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> generator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;summarization&#x27;</span>, <span class="hljs-string">&#x27;Xenova/distilbart-cnn-6-6&#x27;</span>);
<span class="hljs-keyword">const</span> text = <span class="hljs-string">&#x27;The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, &#x27;</span> +
<span class="hljs-string">&#x27;and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. &#x27;</span> +
<span class="hljs-string">&#x27;During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest &#x27;</span> +
<span class="hljs-string">&#x27;man-made structure in the world, a title it held for 41 years until the Chrysler Building in New &#x27;</span> +
<span class="hljs-string">&#x27;York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to &#x27;</span> +
<span class="hljs-string">&#x27;the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the &#x27;</span> +
<span class="hljs-string">&#x27;Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second &#x27;</span> +
<span class="hljs-string">&#x27;tallest free-standing structure in France after the Millau Viaduct.&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generator</span>(text, {
<span class="hljs-attr">max_new_tokens</span>: <span class="hljs-number">100</span>,
});
<span class="hljs-comment">// [{ summary_text: &#x27; The Eiffel Tower is about the same height as an 81-storey building and the tallest structure in Paris. It is the second tallest free-standing structure in France after the Millau Viaduct.&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-p21410"><li><a href="#module_pipelines.SummarizationPipeline">.SummarizationPipeline</a><ul><li><a href="#new_module_pipelines.SummarizationPipeline_new"><code>new SummarizationPipeline(options)</code></a></li> <li><a href="#module_pipelines.SummarizationPipeline+_key"><code>._key</code></a> : <code>’summary_text’</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.SummarizationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-summarizationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-summarizationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new SummarizationPipeline(options)</span></h3> <p data-svelte-h="svelte-10um6eq">Create a new SummarizationPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.SummarizationPipeline+_key" class="group"></a> <h3 class="relative group"><a id="summarizationpipelinekey--code--summarytext--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#summarizationpipelinekey--code--summarytext--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>summarizationPipeline._key : &lt;code> ’ summary_text ’ &lt;/code></span></h3> <p data-svelte-h="svelte-gx6clz"><strong>Kind</strong>: instance property of <a href="#module_pipelines.SummarizationPipeline"><code>SummarizationPipeline</code></a></p> <hr> <a id="module_pipelines.TranslationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinestranslationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestranslationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.TranslationPipeline</span></h2> <p data-svelte-h="svelte-3abd20">Translates text from one language to another.</p> <p data-svelte-h="svelte-1ut0vme"><strong>Example:</strong> Multilingual translation w/ <code>Xenova/nllb-200-distilled-600M</code>.</p> <p data-svelte-h="svelte-dr1wsd">See <a href="https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200" rel="nofollow">here</a>
for the full list of languages and their corresponding codes.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> translator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;translation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/nllb-200-distilled-600M&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">translator</span>(<span class="hljs-string">&#x27;जीवन एक चॉकलेट बॉक्स की तरह है।&#x27;</span>, {
<span class="hljs-attr">src_lang</span>: <span class="hljs-string">&#x27;hin_Deva&#x27;</span>, <span class="hljs-comment">// Hindi</span>
<span class="hljs-attr">tgt_lang</span>: <span class="hljs-string">&#x27;fra_Latn&#x27;</span>, <span class="hljs-comment">// French</span>
});
<span class="hljs-comment">// [{ translation_text: &#x27;La vie est comme une boîte à chocolat.&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-mqh15a"><strong>Example:</strong> Multilingual translation w/ <code>Xenova/m2m100_418M</code>.</p> <p data-svelte-h="svelte-zf4dht">See <a href="https://huggingface.co/facebook/m2m100_418M#languages-covered" rel="nofollow">here</a>
for the full list of languages and their corresponding codes.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> translator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;translation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/m2m100_418M&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">translator</span>(<span class="hljs-string">&#x27;生活就像一盒巧克力。&#x27;</span>, {
<span class="hljs-attr">src_lang</span>: <span class="hljs-string">&#x27;zh&#x27;</span>, <span class="hljs-comment">// Chinese</span>
<span class="hljs-attr">tgt_lang</span>: <span class="hljs-string">&#x27;en&#x27;</span>, <span class="hljs-comment">// English</span>
});
<span class="hljs-comment">// [{ translation_text: &#x27;Life is like a box of chocolate.&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1877ohf"><strong>Example:</strong> Multilingual translation w/ <code>Xenova/mbart-large-50-many-to-many-mmt</code>.</p> <p data-svelte-h="svelte-1ox1juk">See <a href="https://huggingface.co/facebook/mbart-large-50-many-to-many-mmt#languages-covered" rel="nofollow">here</a>
for the full list of languages and their corresponding codes.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> translator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;translation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/mbart-large-50-many-to-many-mmt&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">translator</span>(<span class="hljs-string">&#x27;संयुक्त राष्ट्र के प्रमुख का कहना है कि सीरिया में कोई सैन्य समाधान नहीं है&#x27;</span>, {
<span class="hljs-attr">src_lang</span>: <span class="hljs-string">&#x27;hi_IN&#x27;</span>, <span class="hljs-comment">// Hindi</span>
<span class="hljs-attr">tgt_lang</span>: <span class="hljs-string">&#x27;fr_XX&#x27;</span>, <span class="hljs-comment">// French</span>
});
<span class="hljs-comment">// [{ translation_text: &#x27;Le chef des Nations affirme qu &#x27;il n &#x27;y a military solution in Syria.&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-e4lxrd"><li><a href="#module_pipelines.TranslationPipeline">.TranslationPipeline</a><ul><li><a href="#new_module_pipelines.TranslationPipeline_new"><code>new TranslationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TranslationPipeline+_key"><code>._key</code></a> : <code>’translation_text’</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.TranslationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-translationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-translationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new TranslationPipeline(options)</span></h3> <p data-svelte-h="svelte-6vg3da">Create a new TranslationPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.TranslationPipeline+_key" class="group"></a> <h3 class="relative group"><a id="translationpipelinekey--code--translationtext--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#translationpipelinekey--code--translationtext--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>translationPipeline._key : &lt;code> ’ translation_text ’ &lt;/code></span></h3> <p data-svelte-h="svelte-btu0vj"><strong>Kind</strong>: instance property of <a href="#module_pipelines.TranslationPipeline"><code>TranslationPipeline</code></a></p> <hr> <a id="module_pipelines.TextGenerationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinestextgenerationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestextgenerationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.TextGenerationPipeline</span></h2> <p data-svelte-h="svelte-1yek3op">Language generation pipeline using any <code>ModelWithLMHead</code> or <code>ModelForCausalLM</code>.
This pipeline predicts the words that will follow a specified text prompt.
NOTE: For the full list of generation parameters, see <a href="./utils/generation#module_utils/generation.GenerationConfig"><code>GenerationConfig</code></a>.</p> <p data-svelte-h="svelte-11p32pq"><strong>Example:</strong> Text generation with <code>Xenova/distilgpt2</code> (default settings).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> generator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;text-generation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/distilgpt2&#x27;</span>);
<span class="hljs-keyword">const</span> text = <span class="hljs-string">&#x27;I enjoy walking with my cute dog,&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generator</span>(text);
<span class="hljs-comment">// [{ generated_text: &quot;I enjoy walking with my cute dog, and I love to play with the other dogs.&quot; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1uqom1e"><strong>Example:</strong> Text generation with <code>Xenova/distilgpt2</code> (custom settings).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> generator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;text-generation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/distilgpt2&#x27;</span>);
<span class="hljs-keyword">const</span> text = <span class="hljs-string">&#x27;Once upon a time, there was&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generator</span>(text, {
<span class="hljs-attr">temperature</span>: <span class="hljs-number">2</span>,
<span class="hljs-attr">max_new_tokens</span>: <span class="hljs-number">10</span>,
<span class="hljs-attr">repetition_penalty</span>: <span class="hljs-number">1.5</span>,
<span class="hljs-attr">no_repeat_ngram_size</span>: <span class="hljs-number">2</span>,
<span class="hljs-attr">num_beams</span>: <span class="hljs-number">2</span>,
<span class="hljs-attr">num_return_sequences</span>: <span class="hljs-number">2</span>,
});
<span class="hljs-comment">// [{</span>
<span class="hljs-comment">// &quot;generated_text&quot;: &quot;Once upon a time, there was an abundance of information about the history and activities that&quot;</span>
<span class="hljs-comment">// }, {</span>
<span class="hljs-comment">// &quot;generated_text&quot;: &quot;Once upon a time, there was an abundance of information about the most important and influential&quot;</span>
<span class="hljs-comment">// }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1a7k67n"><strong>Example:</strong> Run code generation with <code>Xenova/codegen-350M-mono</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> generator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;text-generation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/codegen-350M-mono&#x27;</span>);
<span class="hljs-keyword">const</span> text = <span class="hljs-string">&#x27;def fib(n):&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generator</span>(text, {
<span class="hljs-attr">max_new_tokens</span>: <span class="hljs-number">44</span>,
});
<span class="hljs-comment">// [{</span>
<span class="hljs-comment">// generated_text: &#x27;def fib(n):\n&#x27; +</span>
<span class="hljs-comment">// &#x27; if n == 0:\n&#x27; +</span>
<span class="hljs-comment">// &#x27; return 0\n&#x27; +</span>
<span class="hljs-comment">// &#x27; elif n == 1:\n&#x27; +</span>
<span class="hljs-comment">// &#x27; return 1\n&#x27; +</span>
<span class="hljs-comment">// &#x27; else:\n&#x27; +</span>
<span class="hljs-comment">// &#x27; return fib(n-1) + fib(n-2)\n&#x27;</span>
<span class="hljs-comment">// }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-62eu9p"><li><a href="#module_pipelines.TextGenerationPipeline">.TextGenerationPipeline</a><ul><li><a href="#new_module_pipelines.TextGenerationPipeline_new"><code>new TextGenerationPipeline(options)</code></a></li> <li><a href="#module_pipelines.TextGenerationPipeline+_call"><code>._call()</code></a> : <code>TextGenerationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.TextGenerationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-textgenerationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-textgenerationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new TextGenerationPipeline(options)</span></h3> <p data-svelte-h="svelte-xkrmr2">Create a new TextGenerationPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.TextGenerationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="textgenerationpipelinecall--code-textgenerationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#textgenerationpipelinecall--code-textgenerationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>textGenerationPipeline._call() : &lt;code> TextGenerationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-mbcfab"><strong>Kind</strong>: instance method of <a href="#module_pipelines.TextGenerationPipeline"><code>TextGenerationPipeline</code></a></p> <hr> <a id="module_pipelines.ZeroShotClassificationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotclassificationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotclassificationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ZeroShotClassificationPipeline</span></h2> <p data-svelte-h="svelte-104v5zf">NLI-based zero-shot classification pipeline using a <code>ModelForSequenceClassification</code>
trained on NLI (natural language inference) tasks. Equivalent of <code>text-classification</code>
pipelines, but these models don’t require a hardcoded number of potential classes, they
can be chosen at runtime. It usually means it’s slower but it is <strong>much</strong> more flexible.</p> <p data-svelte-h="svelte-17n9q32"><strong>Example:</strong> Zero shot classification with <code>Xenova/mobilebert-uncased-mnli</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;zero-shot-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/mobilebert-uncased-mnli&#x27;</span>);
<span class="hljs-keyword">const</span> text = <span class="hljs-string">&#x27;Last week I upgraded my iOS version and ever since then my phone has been overheating whenever I use your app.&#x27;</span>;
<span class="hljs-keyword">const</span> labels = [ <span class="hljs-string">&#x27;mobile&#x27;</span>, <span class="hljs-string">&#x27;billing&#x27;</span>, <span class="hljs-string">&#x27;website&#x27;</span>, <span class="hljs-string">&#x27;account access&#x27;</span> ];
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(text, labels);
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// sequence: &#x27;Last week I upgraded my iOS version and ever since then my phone has been overheating whenever I use your app.&#x27;,</span>
<span class="hljs-comment">// labels: [ &#x27;mobile&#x27;, &#x27;website&#x27;, &#x27;billing&#x27;, &#x27;account access&#x27; ],</span>
<span class="hljs-comment">// scores: [ 0.5562091040482018, 0.1843621307860853, 0.13942646639336376, 0.12000229877234923 ]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-v99qry"><strong>Example:</strong> Zero shot classification with <code>Xenova/nli-deberta-v3-xsmall</code> (multi-label).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;zero-shot-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/nli-deberta-v3-xsmall&#x27;</span>);
<span class="hljs-keyword">const</span> text = <span class="hljs-string">&#x27;I have a problem with my iphone that needs to be resolved asap!&#x27;</span>;
<span class="hljs-keyword">const</span> labels = [ <span class="hljs-string">&#x27;urgent&#x27;</span>, <span class="hljs-string">&#x27;not urgent&#x27;</span>, <span class="hljs-string">&#x27;phone&#x27;</span>, <span class="hljs-string">&#x27;tablet&#x27;</span>, <span class="hljs-string">&#x27;computer&#x27;</span> ];
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(text, labels, { <span class="hljs-attr">multi_label</span>: <span class="hljs-literal">true</span> });
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// sequence: &#x27;I have a problem with my iphone that needs to be resolved asap!&#x27;,</span>
<span class="hljs-comment">// labels: [ &#x27;urgent&#x27;, &#x27;phone&#x27;, &#x27;computer&#x27;, &#x27;tablet&#x27;, &#x27;not urgent&#x27; ],</span>
<span class="hljs-comment">// scores: [ 0.9958870956360275, 0.9923963400697035, 0.002333537946160235, 0.0015134138567598765, 0.0010699384208377163 ]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-19ik76h"><li><a href="#module_pipelines.ZeroShotClassificationPipeline">.ZeroShotClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotClassificationPipeline_new"><code>new ZeroShotClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotClassificationPipeline+model"><code>.model</code></a> : <code>any</code></li> <li><a href="#module_pipelines.ZeroShotClassificationPipeline+_call"><code>._call()</code></a> : <code>ZeroShotClassificationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ZeroShotClassificationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-zeroshotclassificationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-zeroshotclassificationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ZeroShotClassificationPipeline(options)</span></h3> <p data-svelte-h="svelte-1n1xlcl">Create a new ZeroShotClassificationPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ZeroShotClassificationPipeline+model" class="group"></a> <h3 class="relative group"><a id="zeroshotclassificationpipelinemodel--code-any-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#zeroshotclassificationpipelinemodel--code-any-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>zeroShotClassificationPipeline.model : &lt;code> any &lt;/code></span></h3> <p data-svelte-h="svelte-u37gsd"><strong>Kind</strong>: instance property of <a href="#module_pipelines.ZeroShotClassificationPipeline"><code>ZeroShotClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.ZeroShotClassificationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="zeroshotclassificationpipelinecall--code-zeroshotclassificationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#zeroshotclassificationpipelinecall--code-zeroshotclassificationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>zeroShotClassificationPipeline._call() : &lt;code> ZeroShotClassificationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1ud8h4r"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ZeroShotClassificationPipeline"><code>ZeroShotClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.FeatureExtractionPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesfeatureextractionpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesfeatureextractionpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.FeatureExtractionPipeline</span></h2> <p data-svelte-h="svelte-tzucv0">Feature extraction pipeline using no model head. This pipeline extracts the hidden
states from the base transformer, which can be used as features in downstream tasks.</p> <p data-svelte-h="svelte-zrdgvs"><strong>Example:</strong> Run feature extraction with <code>bert-base-uncased</code> (without pooling/normalization).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> extractor = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;feature-extraction&#x27;</span>, <span class="hljs-string">&#x27;Xenova/bert-base-uncased&#x27;</span>, { <span class="hljs-attr">revision</span>: <span class="hljs-string">&#x27;default&#x27;</span> });
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">extractor</span>(<span class="hljs-string">&#x27;This is a simple test.&#x27;</span>);
<span class="hljs-comment">// Tensor {</span>
<span class="hljs-comment">// type: &#x27;float32&#x27;,</span>
<span class="hljs-comment">// data: Float32Array [0.05939924716949463, 0.021655935794115067, ...],</span>
<span class="hljs-comment">// dims: [1, 8, 768]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-et9i9m"><strong>Example:</strong> Run feature extraction with <code>bert-base-uncased</code> (with pooling/normalization).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> extractor = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;feature-extraction&#x27;</span>, <span class="hljs-string">&#x27;Xenova/bert-base-uncased&#x27;</span>, { <span class="hljs-attr">revision</span>: <span class="hljs-string">&#x27;default&#x27;</span> });
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">extractor</span>(<span class="hljs-string">&#x27;This is a simple test.&#x27;</span>, { <span class="hljs-attr">pooling</span>: <span class="hljs-string">&#x27;mean&#x27;</span>, <span class="hljs-attr">normalize</span>: <span class="hljs-literal">true</span> });
<span class="hljs-comment">// Tensor {</span>
<span class="hljs-comment">// type: &#x27;float32&#x27;,</span>
<span class="hljs-comment">// data: Float32Array [0.03373778983950615, -0.010106077417731285, ...],</span>
<span class="hljs-comment">// dims: [1, 768]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-162t9ct"><strong>Example:</strong> Calculating embeddings with <code>sentence-transformers</code> models.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> extractor = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;feature-extraction&#x27;</span>, <span class="hljs-string">&#x27;Xenova/all-MiniLM-L6-v2&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">extractor</span>(<span class="hljs-string">&#x27;This is a simple test.&#x27;</span>, { <span class="hljs-attr">pooling</span>: <span class="hljs-string">&#x27;mean&#x27;</span>, <span class="hljs-attr">normalize</span>: <span class="hljs-literal">true</span> });
<span class="hljs-comment">// Tensor {</span>
<span class="hljs-comment">// type: &#x27;float32&#x27;,</span>
<span class="hljs-comment">// data: Float32Array [0.09094982594251633, -0.014774246141314507, ...],</span>
<span class="hljs-comment">// dims: [1, 384]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1kus3j4"><strong>Example:</strong> Calculating binary embeddings with <code>sentence-transformers</code> models.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> extractor = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;feature-extraction&#x27;</span>, <span class="hljs-string">&#x27;Xenova/all-MiniLM-L6-v2&#x27;</span>);
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">extractor</span>(<span class="hljs-string">&#x27;This is a simple test.&#x27;</span>, { <span class="hljs-attr">pooling</span>: <span class="hljs-string">&#x27;mean&#x27;</span>, <span class="hljs-attr">quantize</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">precision</span>: <span class="hljs-string">&#x27;binary&#x27;</span> });
<span class="hljs-comment">// Tensor {</span>
<span class="hljs-comment">// type: &#x27;int8&#x27;,</span>
<span class="hljs-comment">// data: Int8Array [49, 108, 24, ...],</span>
<span class="hljs-comment">// dims: [1, 48]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-10y93z3"><li><a href="#module_pipelines.FeatureExtractionPipeline">.FeatureExtractionPipeline</a><ul><li><a href="#new_module_pipelines.FeatureExtractionPipeline_new"><code>new FeatureExtractionPipeline(options)</code></a></li> <li><a href="#module_pipelines.FeatureExtractionPipeline+_call"><code>._call()</code></a> : <code>FeatureExtractionPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.FeatureExtractionPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-featureextractionpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-featureextractionpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new FeatureExtractionPipeline(options)</span></h3> <p data-svelte-h="svelte-8oqlmq">Create a new FeatureExtractionPipeline.</p> <table data-svelte-h="svelte-1iu6wl4"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.FeatureExtractionPipeline+_call" class="group"></a> <h3 class="relative group"><a id="featureextractionpipelinecall--code-featureextractionpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#featureextractionpipelinecall--code-featureextractionpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>featureExtractionPipeline._call() : &lt;code> FeatureExtractionPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-s9g0sr"><strong>Kind</strong>: instance method of <a href="#module_pipelines.FeatureExtractionPipeline"><code>FeatureExtractionPipeline</code></a></p> <hr> <a id="module_pipelines.ImageFeatureExtractionPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesimagefeatureextractionpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagefeatureextractionpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ImageFeatureExtractionPipeline</span></h2> <p data-svelte-h="svelte-z5i7j9">Image feature extraction pipeline using no model head. This pipeline extracts the hidden
states from the base transformer, which can be used as features in downstream tasks.</p> <p data-svelte-h="svelte-n063y1"><strong>Example:</strong> Perform image feature extraction with <code>Xenova/vit-base-patch16-224-in21k</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> image_feature_extractor = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-feature-extraction&#x27;</span>, <span class="hljs-string">&#x27;Xenova/vit-base-patch16-224-in21k&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png&#x27;</span>;
<span class="hljs-keyword">const</span> features = <span class="hljs-keyword">await</span> <span class="hljs-title function_">image_feature_extractor</span>(url);
<span class="hljs-comment">// Tensor {</span>
<span class="hljs-comment">// dims: [ 1, 197, 768 ],</span>
<span class="hljs-comment">// type: &#x27;float32&#x27;,</span>
<span class="hljs-comment">// data: Float32Array(151296) [ ... ],</span>
<span class="hljs-comment">// size: 151296</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-49jj6i"><strong>Example:</strong> Compute image embeddings with <code>Xenova/clip-vit-base-patch32</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> image_feature_extractor = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-feature-extraction&#x27;</span>, <span class="hljs-string">&#x27;Xenova/clip-vit-base-patch32&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png&#x27;</span>;
<span class="hljs-keyword">const</span> features = <span class="hljs-keyword">await</span> <span class="hljs-title function_">image_feature_extractor</span>(url);
<span class="hljs-comment">// Tensor {</span>
<span class="hljs-comment">// dims: [ 1, 512 ],</span>
<span class="hljs-comment">// type: &#x27;float32&#x27;,</span>
<span class="hljs-comment">// data: Float32Array(512) [ ... ],</span>
<span class="hljs-comment">// size: 512</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1x41tbl"><li><a href="#module_pipelines.ImageFeatureExtractionPipeline">.ImageFeatureExtractionPipeline</a><ul><li><a href="#new_module_pipelines.ImageFeatureExtractionPipeline_new"><code>new ImageFeatureExtractionPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageFeatureExtractionPipeline+_call"><code>._call()</code></a> : <code>ImageFeatureExtractionPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ImageFeatureExtractionPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-imagefeatureextractionpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-imagefeatureextractionpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ImageFeatureExtractionPipeline(options)</span></h3> <p data-svelte-h="svelte-1vowjv7">Create a new ImageFeatureExtractionPipeline.</p> <table data-svelte-h="svelte-uwryka"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>ImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ImageFeatureExtractionPipeline+_call" class="group"></a> <h3 class="relative group"><a id="imagefeatureextractionpipelinecall--code-imagefeatureextractionpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#imagefeatureextractionpipelinecall--code-imagefeatureextractionpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>imageFeatureExtractionPipeline._call() : &lt;code> ImageFeatureExtractionPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1m120x7"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ImageFeatureExtractionPipeline"><code>ImageFeatureExtractionPipeline</code></a></p> <hr> <a id="module_pipelines.AudioClassificationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesaudioclassificationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesaudioclassificationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.AudioClassificationPipeline</span></h2> <p data-svelte-h="svelte-9xhkxa">Audio classification pipeline using any <code>AutoModelForAudioClassification</code>.
This pipeline predicts the class of a raw waveform or an audio file.</p> <p data-svelte-h="svelte-11cz03b"><strong>Example:</strong> Perform audio classification with <code>Xenova/wav2vec2-large-xlsr-53-gender-recognition-librispeech</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;audio-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/wav2vec2-large-xlsr-53-gender-recognition-librispeech&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(url);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;male&#x27;, score: 0.9981542229652405 },</span>
<span class="hljs-comment">// { label: &#x27;female&#x27;, score: 0.001845747814513743 }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1mkx6vp"><strong>Example:</strong> Perform audio classification with <code>Xenova/ast-finetuned-audioset-10-10-0.4593</code> and return top 4 results.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;audio-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/ast-finetuned-audioset-10-10-0.4593&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cat_meow.wav&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(url, { <span class="hljs-attr">top_k</span>: <span class="hljs-number">4</span> });
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;Meow&#x27;, score: 0.5617874264717102 },</span>
<span class="hljs-comment">// { label: &#x27;Cat&#x27;, score: 0.22365376353263855 },</span>
<span class="hljs-comment">// { label: &#x27;Domestic animals, pets&#x27;, score: 0.1141069084405899 },</span>
<span class="hljs-comment">// { label: &#x27;Animal&#x27;, score: 0.08985692262649536 },</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-7knu0l"><li><a href="#module_pipelines.AudioClassificationPipeline">.AudioClassificationPipeline</a><ul><li><a href="#new_module_pipelines.AudioClassificationPipeline_new"><code>new AudioClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.AudioClassificationPipeline+_call"><code>._call()</code></a> : <code>AudioClassificationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.AudioClassificationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-audioclassificationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-audioclassificationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new AudioClassificationPipeline(options)</span></h3> <p data-svelte-h="svelte-1enract">Create a new AudioClassificationPipeline.</p> <table data-svelte-h="svelte-1u0ywjh"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>AudioPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.AudioClassificationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="audioclassificationpipelinecall--code-audioclassificationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#audioclassificationpipelinecall--code-audioclassificationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>audioClassificationPipeline._call() : &lt;code> AudioClassificationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-di1dc5"><strong>Kind</strong>: instance method of <a href="#module_pipelines.AudioClassificationPipeline"><code>AudioClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.ZeroShotAudioClassificationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotaudioclassificationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotaudioclassificationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ZeroShotAudioClassificationPipeline</span></h2> <p data-svelte-h="svelte-tmg4zt">Zero shot audio classification pipeline using <code>ClapModel</code>. This pipeline predicts the class of an audio when you
provide an audio and a set of <code>candidate_labels</code>.</p> <p data-svelte-h="svelte-em947q"><strong>Example</strong>: Perform zero-shot audio classification with <code>Xenova/clap-htsat-unfused</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;zero-shot-audio-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/clap-htsat-unfused&#x27;</span>);
<span class="hljs-keyword">const</span> audio = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/dog_barking.wav&#x27;</span>;
<span class="hljs-keyword">const</span> candidate_labels = [<span class="hljs-string">&#x27;dog&#x27;</span>, <span class="hljs-string">&#x27;vaccum cleaner&#x27;</span>];
<span class="hljs-keyword">const</span> scores = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(audio, candidate_labels);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { score: 0.9993992447853088, label: &#x27;dog&#x27; },</span>
<span class="hljs-comment">// { score: 0.0006007603369653225, label: &#x27;vaccum cleaner&#x27; }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1qhhd61"><li><a href="#module_pipelines.ZeroShotAudioClassificationPipeline">.ZeroShotAudioClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotAudioClassificationPipeline_new"><code>new ZeroShotAudioClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotAudioClassificationPipeline+_call"><code>._call()</code></a> : <code>ZeroShotAudioClassificationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ZeroShotAudioClassificationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-zeroshotaudioclassificationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-zeroshotaudioclassificationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ZeroShotAudioClassificationPipeline(options)</span></h3> <p data-svelte-h="svelte-1edlvjn">Create a new ZeroShotAudioClassificationPipeline.</p> <table data-svelte-h="svelte-t7irm8"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextAudioPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ZeroShotAudioClassificationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="zeroshotaudioclassificationpipelinecall--code-zeroshotaudioclassificationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#zeroshotaudioclassificationpipelinecall--code-zeroshotaudioclassificationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>zeroShotAudioClassificationPipeline._call() : &lt;code> ZeroShotAudioClassificationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1cetnsf"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ZeroShotAudioClassificationPipeline"><code>ZeroShotAudioClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.AutomaticSpeechRecognitionPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesautomaticspeechrecognitionpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesautomaticspeechrecognitionpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.AutomaticSpeechRecognitionPipeline</span></h2> <p data-svelte-h="svelte-vm8asa">Pipeline that aims at extracting spoken text contained within some audio.</p> <p data-svelte-h="svelte-p9nqmy"><strong>Example:</strong> Transcribe English.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> transcriber = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;automatic-speech-recognition&#x27;</span>, <span class="hljs-string">&#x27;Xenova/whisper-tiny.en&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">transcriber</span>(url);
<span class="hljs-comment">// { text: &quot; And so my fellow Americans ask not what your country can do for you, ask what you can do for your country.&quot; }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1xb4yln"><strong>Example:</strong> Transcribe English w/ timestamps.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> transcriber = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;automatic-speech-recognition&#x27;</span>, <span class="hljs-string">&#x27;Xenova/whisper-tiny.en&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">transcriber</span>(url, { <span class="hljs-attr">return_timestamps</span>: <span class="hljs-literal">true</span> });
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// text: &quot; And so my fellow Americans ask not what your country can do for you, ask what you can do for your country.&quot;</span>
<span class="hljs-comment">// chunks: [</span>
<span class="hljs-comment">// { timestamp: [0, 8], text: &quot; And so my fellow Americans ask not what your country can do for you&quot; }</span>
<span class="hljs-comment">// { timestamp: [8, 11], text: &quot; ask what you can do for your country.&quot; }</span>
<span class="hljs-comment">// ]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-aly754"><strong>Example:</strong> Transcribe English w/ word-level timestamps.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> transcriber = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;automatic-speech-recognition&#x27;</span>, <span class="hljs-string">&#x27;Xenova/whisper-tiny.en&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/jfk.wav&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">transcriber</span>(url, { <span class="hljs-attr">return_timestamps</span>: <span class="hljs-string">&#x27;word&#x27;</span> });
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// &quot;text&quot;: &quot; And so my fellow Americans ask not what your country can do for you ask what you can do for your country.&quot;,</span>
<span class="hljs-comment">// &quot;chunks&quot;: [</span>
<span class="hljs-comment">// { &quot;text&quot;: &quot; And&quot;, &quot;timestamp&quot;: [0, 0.78] },</span>
<span class="hljs-comment">// { &quot;text&quot;: &quot; so&quot;, &quot;timestamp&quot;: [0.78, 1.06] },</span>
<span class="hljs-comment">// { &quot;text&quot;: &quot; my&quot;, &quot;timestamp&quot;: [1.06, 1.46] },</span>
<span class="hljs-comment">// ...</span>
<span class="hljs-comment">// { &quot;text&quot;: &quot; for&quot;, &quot;timestamp&quot;: [9.72, 9.92] },</span>
<span class="hljs-comment">// { &quot;text&quot;: &quot; your&quot;, &quot;timestamp&quot;: [9.92, 10.22] },</span>
<span class="hljs-comment">// { &quot;text&quot;: &quot; country.&quot;, &quot;timestamp&quot;: [10.22, 13.5] }</span>
<span class="hljs-comment">// ]</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-127z1r2"><strong>Example:</strong> Transcribe French.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> transcriber = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;automatic-speech-recognition&#x27;</span>, <span class="hljs-string">&#x27;Xenova/whisper-small&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/french-audio.mp3&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">transcriber</span>(url, { <span class="hljs-attr">language</span>: <span class="hljs-string">&#x27;french&#x27;</span>, <span class="hljs-attr">task</span>: <span class="hljs-string">&#x27;transcribe&#x27;</span> });
<span class="hljs-comment">// { text: &quot; J&#x27;adore, j&#x27;aime, je n&#x27;aime pas, je déteste.&quot; }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-5ad2vc"><strong>Example:</strong> Translate French to English.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> transcriber = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;automatic-speech-recognition&#x27;</span>, <span class="hljs-string">&#x27;Xenova/whisper-small&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/french-audio.mp3&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">transcriber</span>(url, { <span class="hljs-attr">language</span>: <span class="hljs-string">&#x27;french&#x27;</span>, <span class="hljs-attr">task</span>: <span class="hljs-string">&#x27;translate&#x27;</span> });
<span class="hljs-comment">// { text: &quot; I love, I like, I don&#x27;t like, I hate.&quot; }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1ybp4y9"><strong>Example:</strong> Transcribe/translate audio longer than 30 seconds.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> transcriber = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;automatic-speech-recognition&#x27;</span>, <span class="hljs-string">&#x27;Xenova/whisper-tiny.en&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/ted_60.wav&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">transcriber</span>(url, { <span class="hljs-attr">chunk_length_s</span>: <span class="hljs-number">30</span>, <span class="hljs-attr">stride_length_s</span>: <span class="hljs-number">5</span> });
<span class="hljs-comment">// { text: &quot; So in college, I was a government major, which means [...] So I&#x27;d start off light and I&#x27;d bump it up&quot; }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-257cyp"><li><a href="#module_pipelines.AutomaticSpeechRecognitionPipeline">.AutomaticSpeechRecognitionPipeline</a><ul><li><a href="#new_module_pipelines.AutomaticSpeechRecognitionPipeline_new"><code>new AutomaticSpeechRecognitionPipeline(options)</code></a></li> <li><a href="#module_pipelines.AutomaticSpeechRecognitionPipeline+_call"><code>._call()</code></a> : <code>AutomaticSpeechRecognitionPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.AutomaticSpeechRecognitionPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-automaticspeechrecognitionpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-automaticspeechrecognitionpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new AutomaticSpeechRecognitionPipeline(options)</span></h3> <p data-svelte-h="svelte-1kkefov">Create a new AutomaticSpeechRecognitionPipeline.</p> <table data-svelte-h="svelte-t7irm8"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextAudioPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.AutomaticSpeechRecognitionPipeline+_call" class="group"></a> <h3 class="relative group"><a id="automaticspeechrecognitionpipelinecall--code-automaticspeechrecognitionpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#automaticspeechrecognitionpipelinecall--code-automaticspeechrecognitionpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>automaticSpeechRecognitionPipeline._call() : &lt;code> AutomaticSpeechRecognitionPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-i1526d"><strong>Kind</strong>: instance method of <a href="#module_pipelines.AutomaticSpeechRecognitionPipeline"><code>AutomaticSpeechRecognitionPipeline</code></a></p> <hr> <a id="module_pipelines.ImageToTextPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesimagetotextpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagetotextpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ImageToTextPipeline</span></h2> <p data-svelte-h="svelte-yuzbfo">Image To Text pipeline using a <code>AutoModelForVision2Seq</code>. This pipeline predicts a caption for a given image.</p> <p data-svelte-h="svelte-gwolyd"><strong>Example:</strong> Generate a caption for an image w/ <code>Xenova/vit-gpt2-image-captioning</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> captioner = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-to-text&#x27;</span>, <span class="hljs-string">&#x27;Xenova/vit-gpt2-image-captioning&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">captioner</span>(url);
<span class="hljs-comment">// [{ generated_text: &#x27;a cat laying on a couch with another cat&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-vvjehq"><strong>Example:</strong> Optical Character Recognition (OCR) w/ <code>Xenova/trocr-small-handwritten</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> captioner = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-to-text&#x27;</span>, <span class="hljs-string">&#x27;Xenova/trocr-small-handwritten&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/handwriting.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">captioner</span>(url);
<span class="hljs-comment">// [{ generated_text: &#x27;Mr. Brown commented icily.&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-14lg7tf"><li><a href="#module_pipelines.ImageToTextPipeline">.ImageToTextPipeline</a><ul><li><a href="#new_module_pipelines.ImageToTextPipeline_new"><code>new ImageToTextPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageToTextPipeline+_call"><code>._call()</code></a> : <code>ImageToTextPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ImageToTextPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-imagetotextpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-imagetotextpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ImageToTextPipeline(options)</span></h3> <p data-svelte-h="svelte-10qze5e">Create a new ImageToTextPipeline.</p> <table data-svelte-h="svelte-1r7ciun"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ImageToTextPipeline+_call" class="group"></a> <h3 class="relative group"><a id="imagetotextpipelinecall--code-imagetotextpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#imagetotextpipelinecall--code-imagetotextpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>imageToTextPipeline._call() : &lt;code> ImageToTextPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-tnura3"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ImageToTextPipeline"><code>ImageToTextPipeline</code></a></p> <hr> <a id="module_pipelines.ImageClassificationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesimageclassificationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimageclassificationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ImageClassificationPipeline</span></h2> <p data-svelte-h="svelte-w5osnc">Image classification pipeline using any <code>AutoModelForImageClassification</code>.
This pipeline predicts the class of an image.</p> <p data-svelte-h="svelte-1h4310j"><strong>Example:</strong> Classify an image.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/vit-base-patch16-224&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(url);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;tiger, Panthera tigris&#x27;, score: 0.632695734500885 },</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-xv6hak"><strong>Example:</strong> Classify an image and return top <code>n</code> classes.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/vit-base-patch16-224&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(url, { <span class="hljs-attr">top_k</span>: <span class="hljs-number">3</span> });
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;tiger, Panthera tigris&#x27;, score: 0.632695734500885 },</span>
<span class="hljs-comment">// { label: &#x27;tiger cat&#x27;, score: 0.3634825646877289 },</span>
<span class="hljs-comment">// { label: &#x27;lion, king of beasts, Panthera leo&#x27;, score: 0.00045060308184474707 },</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1ids6l"><strong>Example:</strong> Classify an image and return all classes.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/vit-base-patch16-224&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(url, { <span class="hljs-attr">top_k</span>: <span class="hljs-number">0</span> });
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;tiger, Panthera tigris&#x27;, score: 0.632695734500885 },</span>
<span class="hljs-comment">// { label: &#x27;tiger cat&#x27;, score: 0.3634825646877289 },</span>
<span class="hljs-comment">// { label: &#x27;lion, king of beasts, Panthera leo&#x27;, score: 0.00045060308184474707 },</span>
<span class="hljs-comment">// { label: &#x27;jaguar, panther, Panthera onca, Felis onca&#x27;, score: 0.00035465499968267977 },</span>
<span class="hljs-comment">// ...</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1xz2p9v"><li><a href="#module_pipelines.ImageClassificationPipeline">.ImageClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ImageClassificationPipeline_new"><code>new ImageClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageClassificationPipeline+_call"><code>._call()</code></a> : <code>ImageClassificationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ImageClassificationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-imageclassificationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-imageclassificationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ImageClassificationPipeline(options)</span></h3> <p data-svelte-h="svelte-71b02w">Create a new ImageClassificationPipeline.</p> <table data-svelte-h="svelte-uwryka"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>ImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ImageClassificationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="imageclassificationpipelinecall--code-imageclassificationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#imageclassificationpipelinecall--code-imageclassificationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>imageClassificationPipeline._call() : &lt;code> ImageClassificationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1jslpvf"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ImageClassificationPipeline"><code>ImageClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.ImageSegmentationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesimagesegmentationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagesegmentationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ImageSegmentationPipeline</span></h2> <p data-svelte-h="svelte-1rwi35s">Image segmentation pipeline using any <code>AutoModelForXXXSegmentation</code>.
This pipeline predicts masks of objects and their classes.</p> <p data-svelte-h="svelte-1tpbwb6"><strong>Example:</strong> Perform image segmentation with <code>Xenova/detr-resnet-50-panoptic</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> segmenter = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-segmentation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/detr-resnet-50-panoptic&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">segmenter</span>(url);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { label: &#x27;remote&#x27;, score: 0.9984649419784546, mask: RawImage { ... } },</span>
<span class="hljs-comment">// { label: &#x27;cat&#x27;, score: 0.9994316101074219, mask: RawImage { ... } }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1rarq13"><li><a href="#module_pipelines.ImageSegmentationPipeline">.ImageSegmentationPipeline</a><ul><li><a href="#new_module_pipelines.ImageSegmentationPipeline_new"><code>new ImageSegmentationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageSegmentationPipeline+_call"><code>._call()</code></a> : <code>ImageSegmentationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ImageSegmentationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-imagesegmentationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-imagesegmentationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ImageSegmentationPipeline(options)</span></h3> <p data-svelte-h="svelte-1ctgtyq">Create a new ImageSegmentationPipeline.</p> <table data-svelte-h="svelte-uwryka"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>ImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ImageSegmentationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="imagesegmentationpipelinecall--code-imagesegmentationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#imagesegmentationpipelinecall--code-imagesegmentationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>imageSegmentationPipeline._call() : &lt;code> ImageSegmentationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1ql34f7"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ImageSegmentationPipeline"><code>ImageSegmentationPipeline</code></a></p> <hr> <a id="module_pipelines.ZeroShotImageClassificationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotimageclassificationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotimageclassificationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ZeroShotImageClassificationPipeline</span></h2> <p data-svelte-h="svelte-20dgme">Zero shot image classification pipeline. This pipeline predicts the class of
an image when you provide an image and a set of <code>candidate_labels</code>.</p> <p data-svelte-h="svelte-eob2i5"><strong>Example:</strong> Zero shot image classification w/ <code>Xenova/clip-vit-base-patch32</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> classifier = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;zero-shot-image-classification&#x27;</span>, <span class="hljs-string">&#x27;Xenova/clip-vit-base-patch32&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">classifier</span>(url, [<span class="hljs-string">&#x27;tiger&#x27;</span>, <span class="hljs-string">&#x27;horse&#x27;</span>, <span class="hljs-string">&#x27;dog&#x27;</span>]);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// { score: 0.9993917942047119, label: &#x27;tiger&#x27; },</span>
<span class="hljs-comment">// { score: 0.0003519294841680676, label: &#x27;horse&#x27; },</span>
<span class="hljs-comment">// { score: 0.0002562698791734874, label: &#x27;dog&#x27; }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-ej6a5r"><li><a href="#module_pipelines.ZeroShotImageClassificationPipeline">.ZeroShotImageClassificationPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotImageClassificationPipeline_new"><code>new ZeroShotImageClassificationPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotImageClassificationPipeline+_call"><code>._call()</code></a> : <code>ZeroShotImageClassificationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ZeroShotImageClassificationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-zeroshotimageclassificationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-zeroshotimageclassificationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ZeroShotImageClassificationPipeline(options)</span></h3> <p data-svelte-h="svelte-3wys82">Create a new ZeroShotImageClassificationPipeline.</p> <table data-svelte-h="svelte-1r7ciun"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ZeroShotImageClassificationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="zeroshotimageclassificationpipelinecall--code-zeroshotimageclassificationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#zeroshotimageclassificationpipelinecall--code-zeroshotimageclassificationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>zeroShotImageClassificationPipeline._call() : &lt;code> ZeroShotImageClassificationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-2y0z4b"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ZeroShotImageClassificationPipeline"><code>ZeroShotImageClassificationPipeline</code></a></p> <hr> <a id="module_pipelines.ObjectDetectionPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesobjectdetectionpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesobjectdetectionpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ObjectDetectionPipeline</span></h2> <p data-svelte-h="svelte-11wm84h">Object detection pipeline using any <code>AutoModelForObjectDetection</code>.
This pipeline predicts bounding boxes of objects and their classes.</p> <p data-svelte-h="svelte-tf175f"><strong>Example:</strong> Run object-detection with <code>Xenova/detr-resnet-50</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> detector = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;object-detection&#x27;</span>, <span class="hljs-string">&#x27;Xenova/detr-resnet-50&#x27;</span>);
<span class="hljs-keyword">const</span> img = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">detector</span>(img, { <span class="hljs-attr">threshold</span>: <span class="hljs-number">0.9</span> });
<span class="hljs-comment">// [{</span>
<span class="hljs-comment">// score: 0.9976370930671692,</span>
<span class="hljs-comment">// label: &quot;remote&quot;,</span>
<span class="hljs-comment">// box: { xmin: 31, ymin: 68, xmax: 190, ymax: 118 }</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// ...</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.9984092116355896,</span>
<span class="hljs-comment">// label: &quot;cat&quot;,</span>
<span class="hljs-comment">// box: { xmin: 331, ymin: 19, xmax: 649, ymax: 371 }</span>
<span class="hljs-comment">// }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-b3ue47"><li><a href="#module_pipelines.ObjectDetectionPipeline">.ObjectDetectionPipeline</a><ul><li><a href="#new_module_pipelines.ObjectDetectionPipeline_new"><code>new ObjectDetectionPipeline(options)</code></a></li> <li><a href="#module_pipelines.ObjectDetectionPipeline+_call"><code>._call()</code></a> : <code>ObjectDetectionPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ObjectDetectionPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-objectdetectionpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-objectdetectionpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ObjectDetectionPipeline(options)</span></h3> <p data-svelte-h="svelte-1la8w69">Create a new ObjectDetectionPipeline.</p> <table data-svelte-h="svelte-uwryka"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>ImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ObjectDetectionPipeline+_call" class="group"></a> <h3 class="relative group"><a id="objectdetectionpipelinecall--code-objectdetectionpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#objectdetectionpipelinecall--code-objectdetectionpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>objectDetectionPipeline._call() : &lt;code> ObjectDetectionPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-i9mudt"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ObjectDetectionPipeline"><code>ObjectDetectionPipeline</code></a></p> <hr> <a id="module_pipelines.ZeroShotObjectDetectionPipeline" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotobjectdetectionpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotobjectdetectionpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ZeroShotObjectDetectionPipeline</span></h2> <p data-svelte-h="svelte-1hdoc64">Zero-shot object detection pipeline. This pipeline predicts bounding boxes of
objects when you provide an image and a set of <code>candidate_labels</code>.</p> <p data-svelte-h="svelte-yw3rra"><strong>Example:</strong> Zero-shot object detection w/ <code>Xenova/owlvit-base-patch32</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> detector = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;zero-shot-object-detection&#x27;</span>, <span class="hljs-string">&#x27;Xenova/owlvit-base-patch32&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/astronaut.png&#x27;</span>;
<span class="hljs-keyword">const</span> candidate_labels = [<span class="hljs-string">&#x27;human face&#x27;</span>, <span class="hljs-string">&#x27;rocket&#x27;</span>, <span class="hljs-string">&#x27;helmet&#x27;</span>, <span class="hljs-string">&#x27;american flag&#x27;</span>];
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">detector</span>(url, candidate_labels);
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.24392342567443848,</span>
<span class="hljs-comment">// label: &#x27;human face&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 180, ymin: 67, xmax: 274, ymax: 175 }</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.15129457414150238,</span>
<span class="hljs-comment">// label: &#x27;american flag&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 0, ymin: 4, xmax: 106, ymax: 513 }</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.13649864494800568,</span>
<span class="hljs-comment">// label: &#x27;helmet&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 277, ymin: 337, xmax: 511, ymax: 511 }</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.10262022167444229,</span>
<span class="hljs-comment">// label: &#x27;rocket&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 352, ymin: -1, xmax: 463, ymax: 287 }</span>
<span class="hljs-comment">// }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1kny7rm"><strong>Example:</strong> Zero-shot object detection w/ <code>Xenova/owlvit-base-patch32</code> (returning top 4 matches and setting a threshold).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> detector = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;zero-shot-object-detection&#x27;</span>, <span class="hljs-string">&#x27;Xenova/owlvit-base-patch32&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/beach.png&#x27;</span>;
<span class="hljs-keyword">const</span> candidate_labels = [<span class="hljs-string">&#x27;hat&#x27;</span>, <span class="hljs-string">&#x27;book&#x27;</span>, <span class="hljs-string">&#x27;sunglasses&#x27;</span>, <span class="hljs-string">&#x27;camera&#x27;</span>];
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">detector</span>(url, candidate_labels, { <span class="hljs-attr">top_k</span>: <span class="hljs-number">4</span>, <span class="hljs-attr">threshold</span>: <span class="hljs-number">0.05</span> });
<span class="hljs-comment">// [</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.1606510728597641,</span>
<span class="hljs-comment">// label: &#x27;sunglasses&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 347, ymin: 229, xmax: 429, ymax: 264 }</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.08935828506946564,</span>
<span class="hljs-comment">// label: &#x27;hat&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 38, ymin: 174, xmax: 258, ymax: 364 }</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.08530698716640472,</span>
<span class="hljs-comment">// label: &#x27;camera&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 187, ymin: 350, xmax: 260, ymax: 411 }</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// score: 0.08349756896495819,</span>
<span class="hljs-comment">// label: &#x27;book&#x27;,</span>
<span class="hljs-comment">// box: { xmin: 261, ymin: 280, xmax: 494, ymax: 425 }</span>
<span class="hljs-comment">// }</span>
<span class="hljs-comment">// ]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1sje1nx"><li><a href="#module_pipelines.ZeroShotObjectDetectionPipeline">.ZeroShotObjectDetectionPipeline</a><ul><li><a href="#new_module_pipelines.ZeroShotObjectDetectionPipeline_new"><code>new ZeroShotObjectDetectionPipeline(options)</code></a></li> <li><a href="#module_pipelines.ZeroShotObjectDetectionPipeline+_call"><code>._call()</code></a> : <code>ZeroShotObjectDetectionPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ZeroShotObjectDetectionPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-zeroshotobjectdetectionpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-zeroshotobjectdetectionpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ZeroShotObjectDetectionPipeline(options)</span></h3> <p data-svelte-h="svelte-t69287">Create a new ZeroShotObjectDetectionPipeline.</p> <table data-svelte-h="svelte-1r7ciun"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ZeroShotObjectDetectionPipeline+_call" class="group"></a> <h3 class="relative group"><a id="zeroshotobjectdetectionpipelinecall--code-zeroshotobjectdetectionpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#zeroshotobjectdetectionpipelinecall--code-zeroshotobjectdetectionpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>zeroShotObjectDetectionPipeline._call() : &lt;code> ZeroShotObjectDetectionPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-voaoyf"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ZeroShotObjectDetectionPipeline"><code>ZeroShotObjectDetectionPipeline</code></a></p> <hr> <a id="module_pipelines.DocumentQuestionAnsweringPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesdocumentquestionansweringpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesdocumentquestionansweringpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.DocumentQuestionAnsweringPipeline</span></h2> <p data-svelte-h="svelte-iv1c6p">Document Question Answering pipeline using any <code>AutoModelForDocumentQuestionAnswering</code>.
The inputs/outputs are similar to the (extractive) question answering pipeline; however,
the pipeline takes an image (and optional OCR’d words/boxes) as input instead of text context.</p> <p data-svelte-h="svelte-1mtx2cy"><strong>Example:</strong> Answer questions about a document with <code>Xenova/donut-base-finetuned-docvqa</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> qa_pipeline = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;document-question-answering&#x27;</span>, <span class="hljs-string">&#x27;Xenova/donut-base-finetuned-docvqa&#x27;</span>);
<span class="hljs-keyword">const</span> image = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/invoice.png&#x27;</span>;
<span class="hljs-keyword">const</span> question = <span class="hljs-string">&#x27;What is the invoice number?&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">qa_pipeline</span>(image, question);
<span class="hljs-comment">// [{ answer: &#x27;us-001&#x27; }]</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1vh9slr"><li><a href="#module_pipelines.DocumentQuestionAnsweringPipeline">.DocumentQuestionAnsweringPipeline</a><ul><li><a href="#new_module_pipelines.DocumentQuestionAnsweringPipeline_new"><code>new DocumentQuestionAnsweringPipeline(options)</code></a></li> <li><a href="#module_pipelines.DocumentQuestionAnsweringPipeline+_call"><code>._call()</code></a> : <code>DocumentQuestionAnsweringPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.DocumentQuestionAnsweringPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-documentquestionansweringpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-documentquestionansweringpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new DocumentQuestionAnsweringPipeline(options)</span></h3> <p data-svelte-h="svelte-at8fug">Create a new DocumentQuestionAnsweringPipeline.</p> <table data-svelte-h="svelte-1r7ciun"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.DocumentQuestionAnsweringPipeline+_call" class="group"></a> <h3 class="relative group"><a id="documentquestionansweringpipelinecall--code-documentquestionansweringpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#documentquestionansweringpipelinecall--code-documentquestionansweringpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>documentQuestionAnsweringPipeline._call() : &lt;code> DocumentQuestionAnsweringPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-pvyv43"><strong>Kind</strong>: instance method of <a href="#module_pipelines.DocumentQuestionAnsweringPipeline"><code>DocumentQuestionAnsweringPipeline</code></a></p> <hr> <a id="module_pipelines.TextToAudioPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinestexttoaudiopipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestexttoaudiopipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.TextToAudioPipeline</span></h2> <p data-svelte-h="svelte-1nzvfes">Text-to-audio generation pipeline using any <code>AutoModelForTextToWaveform</code> or <code>AutoModelForTextToSpectrogram</code>.
This pipeline generates an audio file from an input text and optional other conditional inputs.</p> <p data-svelte-h="svelte-1qq0cp9"><strong>Example:</strong> Generate audio from text with <code>Xenova/speecht5_tts</code>.</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> synthesizer = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;text-to-speech&#x27;</span>, <span class="hljs-string">&#x27;Xenova/speecht5_tts&#x27;</span>, { <span class="hljs-attr">quantized</span>: <span class="hljs-literal">false</span> });
<span class="hljs-keyword">const</span> speaker_embeddings = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speaker_embeddings.bin&#x27;</span>;
<span class="hljs-keyword">const</span> out = <span class="hljs-keyword">await</span> <span class="hljs-title function_">synthesizer</span>(<span class="hljs-string">&#x27;Hello, my dog is cute&#x27;</span>, { speaker_embeddings });
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// audio: Float32Array(26112) [-0.00005657337896991521, 0.00020583874720614403, ...],</span>
<span class="hljs-comment">// sampling_rate: 16000</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1mslt41">You can then save the audio to a .wav file with the <code>wavefile</code> package:</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">import</span> wavefile <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;wavefile&#x27;</span>;
<span class="hljs-keyword">import</span> fs <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;fs&#x27;</span>;
<span class="hljs-keyword">const</span> wav = <span class="hljs-keyword">new</span> wavefile.<span class="hljs-title class_">WaveFile</span>();
wav.<span class="hljs-title function_">fromScratch</span>(<span class="hljs-number">1</span>, out.<span class="hljs-property">sampling_rate</span>, <span class="hljs-string">&#x27;32f&#x27;</span>, out.<span class="hljs-property">audio</span>);
fs.<span class="hljs-title function_">writeFileSync</span>(<span class="hljs-string">&#x27;out.wav&#x27;</span>, wav.<span class="hljs-title function_">toBuffer</span>());<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-dehksg"><strong>Example:</strong> Multilingual speech generation with <code>Xenova/mms-tts-fra</code>. See <a href="https://huggingface.co/models?pipeline_tag=text-to-speech&other=vits&sort=trending" rel="nofollow">here</a> for the full list of available languages (1107).</p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> synthesizer = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;text-to-speech&#x27;</span>, <span class="hljs-string">&#x27;Xenova/mms-tts-fra&#x27;</span>);
<span class="hljs-keyword">const</span> out = <span class="hljs-keyword">await</span> <span class="hljs-title function_">synthesizer</span>(<span class="hljs-string">&#x27;Bonjour&#x27;</span>);
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// audio: Float32Array(23808) [-0.00037693005288019776, 0.0003325853613205254, ...],</span>
<span class="hljs-comment">// sampling_rate: 16000</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1jpp8cv"><li><a href="#module_pipelines.TextToAudioPipeline">.TextToAudioPipeline</a><ul><li><a href="#new_module_pipelines.TextToAudioPipeline_new"><code>new TextToAudioPipeline(options)</code></a></li> <li><a href="#module_pipelines.TextToAudioPipeline+_call"><code>._call()</code></a> : <code>TextToAudioPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.TextToAudioPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-texttoaudiopipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-texttoaudiopipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new TextToAudioPipeline(options)</span></h3> <p data-svelte-h="svelte-ipwl63">Create a new TextToAudioPipeline.</p> <table data-svelte-h="svelte-asell3"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>TextToAudioPipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.TextToAudioPipeline+_call" class="group"></a> <h3 class="relative group"><a id="texttoaudiopipelinecall--code-texttoaudiopipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#texttoaudiopipelinecall--code-texttoaudiopipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>textToAudioPipeline._call() : &lt;code> TextToAudioPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-1e762tl"><strong>Kind</strong>: instance method of <a href="#module_pipelines.TextToAudioPipeline"><code>TextToAudioPipeline</code></a></p> <hr> <a id="module_pipelines.ImageToImagePipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesimagetoimagepipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagetoimagepipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.ImageToImagePipeline</span></h2> <p data-svelte-h="svelte-1y1a6n">Image to Image pipeline using any <code>AutoModelForImageToImage</code>. This pipeline generates an image based on a previous image input.</p> <p data-svelte-h="svelte-el75jg"><strong>Example:</strong> Super-resolution w/ <code>Xenova/swin2SR-classical-sr-x2-64</code></p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> upscaler = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;image-to-image&#x27;</span>, <span class="hljs-string">&#x27;Xenova/swin2SR-classical-sr-x2-64&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/butterfly.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> output = <span class="hljs-keyword">await</span> <span class="hljs-title function_">upscaler</span>(url);
<span class="hljs-comment">// RawImage {</span>
<span class="hljs-comment">// data: Uint8Array(786432) [ 41, 31, 24, 43, ... ],</span>
<span class="hljs-comment">// width: 512,</span>
<span class="hljs-comment">// height: 512,</span>
<span class="hljs-comment">// channels: 3</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-1hvigd"><li><a href="#module_pipelines.ImageToImagePipeline">.ImageToImagePipeline</a><ul><li><a href="#new_module_pipelines.ImageToImagePipeline_new"><code>new ImageToImagePipeline(options)</code></a></li> <li><a href="#module_pipelines.ImageToImagePipeline+_call"><code>._call()</code></a> : <code>ImageToImagePipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.ImageToImagePipeline_new" class="group"></a> <h3 class="relative group"><a id="new-imagetoimagepipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-imagetoimagepipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new ImageToImagePipeline(options)</span></h3> <p data-svelte-h="svelte-dhr5hm">Create a new ImageToImagePipeline.</p> <table data-svelte-h="svelte-uwryka"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>ImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.ImageToImagePipeline+_call" class="group"></a> <h3 class="relative group"><a id="imagetoimagepipelinecall--code-imagetoimagepipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#imagetoimagepipelinecall--code-imagetoimagepipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>imageToImagePipeline._call() : &lt;code> ImageToImagePipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-diiw1n"><strong>Kind</strong>: instance method of <a href="#module_pipelines.ImageToImagePipeline"><code>ImageToImagePipeline</code></a></p> <hr> <a id="module_pipelines.DepthEstimationPipeline" class="group"></a> <h2 class="relative group"><a id="pipelinesdepthestimationpipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesdepthestimationpipeline"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.DepthEstimationPipeline</span></h2> <p data-svelte-h="svelte-cmozej">Depth estimation pipeline using any <code>AutoModelForDepthEstimation</code>. This pipeline predicts the depth of an image.</p> <p data-svelte-h="svelte-10zf5uq"><strong>Example:</strong> Depth estimation w/ <code>Xenova/dpt-hybrid-midas</code></p> <div class="code-block relative"><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg class="" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg> <div class="absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0"><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent; "></div> Copied</div></button></div> <pre class=""><!-- HTML_TAG_START --><span class="hljs-keyword">const</span> depth_estimator = <span class="hljs-keyword">await</span> <span class="hljs-title function_">pipeline</span>(<span class="hljs-string">&#x27;depth-estimation&#x27;</span>, <span class="hljs-string">&#x27;Xenova/dpt-hybrid-midas&#x27;</span>);
<span class="hljs-keyword">const</span> url = <span class="hljs-string">&#x27;https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cats.jpg&#x27;</span>;
<span class="hljs-keyword">const</span> out = <span class="hljs-keyword">await</span> <span class="hljs-title function_">depth_estimator</span>(url);
<span class="hljs-comment">// {</span>
<span class="hljs-comment">// predicted_depth: Tensor {</span>
<span class="hljs-comment">// dims: [ 384, 384 ],</span>
<span class="hljs-comment">// type: &#x27;float32&#x27;,</span>
<span class="hljs-comment">// data: Float32Array(147456) [ 542.859130859375, 545.2833862304688, 546.1649169921875, ... ],</span>
<span class="hljs-comment">// size: 147456</span>
<span class="hljs-comment">// },</span>
<span class="hljs-comment">// depth: RawImage {</span>
<span class="hljs-comment">// data: Uint8Array(307200) [ 86, 86, 86, ... ],</span>
<span class="hljs-comment">// width: 640,</span>
<span class="hljs-comment">// height: 480,</span>
<span class="hljs-comment">// channels: 1</span>
<span class="hljs-comment">// }</span>
<span class="hljs-comment">// }</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-s10qq4"><strong>Kind</strong>: static class of <a href="#module_pipelines"><code>pipelines</code></a></p> <ul data-svelte-h="svelte-l45353"><li><a href="#module_pipelines.DepthEstimationPipeline">.DepthEstimationPipeline</a><ul><li><a href="#new_module_pipelines.DepthEstimationPipeline_new"><code>new DepthEstimationPipeline(options)</code></a></li> <li><a href="#module_pipelines.DepthEstimationPipeline+_call"><code>._call()</code></a> : <code>DepthEstimationPipelineCallback</code></li></ul></li></ul> <hr> <a id="new_module_pipelines.DepthEstimationPipeline_new" class="group"></a> <h3 class="relative group"><a id="new-depthestimationpipelineoptions" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#new-depthestimationpipelineoptions"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>new DepthEstimationPipeline(options)</span></h3> <p data-svelte-h="svelte-h6i1s9">Create a new DepthEstimationPipeline.</p> <table data-svelte-h="svelte-uwryka"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>options</td><td><code>ImagePipelineConstructorArgs</code></td><td><p>An object used to instantiate the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines.DepthEstimationPipeline+_call" class="group"></a> <h3 class="relative group"><a id="depthestimationpipelinecall--code-depthestimationpipelinecallback-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#depthestimationpipelinecall--code-depthestimationpipelinecallback-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>depthEstimationPipeline._call() : &lt;code> DepthEstimationPipelineCallback &lt;/code></span></h3> <p data-svelte-h="svelte-k6swrx"><strong>Kind</strong>: instance method of <a href="#module_pipelines.DepthEstimationPipeline"><code>DepthEstimationPipeline</code></a></p> <hr> <a id="module_pipelines.pipeline" class="group"></a> <h2 class="relative group"><a id="pipelinespipelinetask-model-options--code--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinespipelinetask-model-options--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines.pipeline(task, [model], [options]) ⇒ &lt;code> * &lt;/code></span></h2> <p data-svelte-h="svelte-1drpefn">Utility factory method to build a <code>Pipeline</code> object.</p> <p data-svelte-h="svelte-gbcntq"><strong>Kind</strong>: static method of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>*</code> - A Pipeline object for the specified task.<br> <strong>Throws</strong>:</p> <ul data-svelte-h="svelte-wk6owh"><li><code>Error</code> If an unsupported pipeline is requested.</li></ul> <table data-svelte-h="svelte-1j0rydw"><thead><tr><th>Param</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>task</td><td><code>T</code></td><td></td><td><p>The task defining which pipeline will be returned. Currently accepted tasks are:</p> <ul><li><code>&quot;audio-classification&quot;</code>: will return a <code>AudioClassificationPipeline</code>.</li> <li><code>&quot;automatic-speech-recognition&quot;</code>: will return a <code>AutomaticSpeechRecognitionPipeline</code>.</li> <li><code>&quot;depth-estimation&quot;</code>: will return a <code>DepthEstimationPipeline</code>.</li> <li><code>&quot;document-question-answering&quot;</code>: will return a <code>DocumentQuestionAnsweringPipeline</code>.</li> <li><code>&quot;feature-extraction&quot;</code>: will return a <code>FeatureExtractionPipeline</code>.</li> <li><code>&quot;fill-mask&quot;</code>: will return a <code>FillMaskPipeline</code>.</li> <li><code>&quot;image-classification&quot;</code>: will return a <code>ImageClassificationPipeline</code>.</li> <li><code>&quot;image-segmentation&quot;</code>: will return a <code>ImageSegmentationPipeline</code>.</li> <li><code>&quot;image-to-text&quot;</code>: will return a <code>ImageToTextPipeline</code>.</li> <li><code>&quot;object-detection&quot;</code>: will return a <code>ObjectDetectionPipeline</code>.</li> <li><code>&quot;question-answering&quot;</code>: will return a <code>QuestionAnsweringPipeline</code>.</li> <li><code>&quot;summarization&quot;</code>: will return a <code>SummarizationPipeline</code>.</li> <li><code>&quot;text2text-generation&quot;</code>: will return a <code>Text2TextGenerationPipeline</code>.</li> <li><code>&quot;text-classification&quot;</code> (alias &quot;sentiment-analysis&quot; available): will return a <code>TextClassificationPipeline</code>.</li> <li><code>&quot;text-generation&quot;</code>: will return a <code>TextGenerationPipeline</code>.</li> <li><code>&quot;token-classification&quot;</code> (alias &quot;ner&quot; available): will return a <code>TokenClassificationPipeline</code>.</li> <li><code>&quot;translation&quot;</code>: will return a <code>TranslationPipeline</code>.</li> <li><code>&quot;translation_xx_to_yy&quot;</code>: will return a <code>TranslationPipeline</code>.</li> <li><code>&quot;zero-shot-classification&quot;</code>: will return a <code>ZeroShotClassificationPipeline</code>.</li> <li><code>&quot;zero-shot-audio-classification&quot;</code>: will return a <code>ZeroShotAudioClassificationPipeline</code>.</li> <li><code>&quot;zero-shot-image-classification&quot;</code>: will return a <code>ZeroShotImageClassificationPipeline</code>.</li> <li><code>&quot;zero-shot-object-detection&quot;</code>: will return a <code>ZeroShotObjectDetectionPipeline</code>.</li></ul></td> </tr><tr><td>[model]</td><td><code>string</code></td><td><code>null</code></td><td><p>The name of the pre-trained model to use. If not specified, the default model for the task will be used.</p></td> </tr><tr><td>[options]</td><td><code>*</code></td><td></td><td><p>Optional parameters for the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ImagePipelineInputs" class="group"></a> <h2 class="relative group"><a id="pipelinesimagepipelineinputs--code-string-code--code-rawimage-code--code-url-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagepipelineinputs--code-string-code--code-rawimage-code--code-url-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ImagePipelineInputs : &lt;code> string &lt;/code> | &lt;code> RawImage &lt;/code> | &lt;code> URL &lt;/code></span></h2> <p data-svelte-h="svelte-1axcw5l"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a></p> <hr> <a id="module_pipelines..AudioPipelineInputs" class="group"></a> <h2 class="relative group"><a id="pipelinesaudiopipelineinputs--code-string-code--code-url-code--code-float32array-code--code-float64array-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesaudiopipelineinputs--code-string-code--code-url-code--code-float32array-code--code-float64array-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~AudioPipelineInputs : &lt;code> string &lt;/code> | &lt;code> URL &lt;/code> | &lt;code> Float32Array &lt;/code> | &lt;code> Float64Array &lt;/code></span></h2> <p data-svelte-h="svelte-1axcw5l"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a></p> <hr> <a id="module_pipelines..BoundingBox" class="group"></a> <h2 class="relative group"><a id="pipelinesboundingbox--code-object-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesboundingbox--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~BoundingBox : &lt;code> Object &lt;/code></span></h2> <p data-svelte-h="svelte-ptv3i7"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Properties</strong></p> <table data-svelte-h="svelte-1ggz2h3"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>xmin</td><td><code>number</code></td><td><p>The minimum x coordinate of the bounding box.</p></td> </tr><tr><td>ymin</td><td><code>number</code></td><td><p>The minimum y coordinate of the bounding box.</p></td> </tr><tr><td>xmax</td><td><code>number</code></td><td><p>The maximum x coordinate of the bounding box.</p></td> </tr><tr><td>ymax</td><td><code>number</code></td><td><p>The maximum y coordinate of the bounding box.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..Disposable" class="group"></a> <h2 class="relative group"><a id="pipelinesdisposable--code-promise--void--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesdisposable--code-promise--void--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~Disposable ⇒ &lt;code> Promise. &lt; void > &lt;/code></span></h2> <p data-svelte-h="svelte-1u62ns5"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;void&gt;</code> - A promise that resolves when the item has been disposed.<br> <strong>Properties</strong></p> <table data-svelte-h="svelte-rk1slv"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>dispose</td><td><code>DisposeType</code></td><td><p>A promise that resolves when the pipeline has been disposed.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TextPipelineConstructorArgs" class="group"></a> <h2 class="relative group"><a id="pipelinestextpipelineconstructorargs--code-object-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestextpipelineconstructorargs--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TextPipelineConstructorArgs : &lt;code> Object &lt;/code></span></h2> <p data-svelte-h="svelte-34syj8">An object used to instantiate a text-based pipeline.</p> <p data-svelte-h="svelte-ptv3i7"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Properties</strong></p> <table data-svelte-h="svelte-1fvmgx7"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>task</td><td><code>string</code></td><td><p>The task of the pipeline. Useful for specifying subtasks.</p></td> </tr><tr><td>model</td><td><code>PreTrainedModel</code></td><td><p>The model used by the pipeline.</p></td> </tr><tr><td>tokenizer</td><td><code>PreTrainedTokenizer</code></td><td><p>The tokenizer used by the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ImagePipelineConstructorArgs" class="group"></a> <h2 class="relative group"><a id="pipelinesimagepipelineconstructorargs--code-object-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagepipelineconstructorargs--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ImagePipelineConstructorArgs : &lt;code> Object &lt;/code></span></h2> <p data-svelte-h="svelte-1mr04yh">An object used to instantiate an audio-based pipeline.</p> <p data-svelte-h="svelte-ptv3i7"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Properties</strong></p> <table data-svelte-h="svelte-1agpzvo"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>task</td><td><code>string</code></td><td><p>The task of the pipeline. Useful for specifying subtasks.</p></td> </tr><tr><td>model</td><td><code>PreTrainedModel</code></td><td><p>The model used by the pipeline.</p></td> </tr><tr><td>processor</td><td><code>Processor</code></td><td><p>The processor used by the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TextImagePipelineConstructorArgs" class="group"></a> <h2 class="relative group"><a id="pipelinestextimagepipelineconstructorargs--code-object-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestextimagepipelineconstructorargs--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TextImagePipelineConstructorArgs : &lt;code> Object &lt;/code></span></h2> <p data-svelte-h="svelte-6hgc2w">An object used to instantiate a text- and audio-based pipeline.</p> <p data-svelte-h="svelte-ptv3i7"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Properties</strong></p> <table data-svelte-h="svelte-10ghpzh"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>task</td><td><code>string</code></td><td><p>The task of the pipeline. Useful for specifying subtasks.</p></td> </tr><tr><td>model</td><td><code>PreTrainedModel</code></td><td><p>The model used by the pipeline.</p></td> </tr><tr><td>tokenizer</td><td><code>PreTrainedTokenizer</code></td><td><p>The tokenizer used by the pipeline.</p></td> </tr><tr><td>processor</td><td><code>Processor</code></td><td><p>The processor used by the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TextClassificationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinestextclassificationpipelinetype--code-promise--textclassificationoutputarray--textclassificationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestextclassificationpipelinetype--code-promise--textclassificationoutputarray--textclassificationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TextClassificationPipelineType ⇒ &lt;code> Promise. &lt; (TextClassificationOutput|Array &lt; TextClassificationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-5irp67">Parameters specific to text classification pipelines.</p> <p data-svelte-h="svelte-1q1ef1c"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(TextClassificationOutput|Array&lt;TextClassificationOutput&gt;)&gt;</code> - An array or object containing the predicted labels and scores.</p> <table data-svelte-h="svelte-1n7bxpl"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>The input text(s) to be classified.</p></td> </tr><tr><td>[options]</td><td><code>TextClassificationPipelineOptions</code></td><td><p>The options to use for text classification.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-1jphmrz"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>The label predicted.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>The corresponding probability.</p></td> </tr><tr><td>[top_k]</td><td><code>number</code></td><td><code>1</code></td><td><p>The number of top predictions to be returned.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TokenClassificationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinestokenclassificationpipelinetype--code-promise--tokenclassificationoutputarray--tokenclassificationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestokenclassificationpipelinetype--code-promise--tokenclassificationoutputarray--tokenclassificationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TokenClassificationPipelineType ⇒ &lt;code> Promise. &lt; (TokenClassificationOutput|Array &lt; TokenClassificationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-e99ya5">Parameters specific to token classification pipelines.</p> <p data-svelte-h="svelte-1bsoqra"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(TokenClassificationOutput|Array&lt;TokenClassificationOutput&gt;)&gt;</code> - The result.</p> <table data-svelte-h="svelte-wkggw2"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>One or several texts (or one list of texts) for token classification.</p></td> </tr><tr><td>[options]</td><td><code>TokenClassificationPipelineOptions</code></td><td><p>The options to use for token classification.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-11kx8qp"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>word</td><td><code>string</code></td><td><p>The token/word classified. This is obtained by decoding the selected tokens.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td><p>The corresponding probability for <code>entity</code>.</p></td> </tr><tr><td>entity</td><td><code>string</code></td><td><p>The entity predicted for that token/word.</p></td> </tr><tr><td>index</td><td><code>number</code></td><td><p>The index of the corresponding token in the sentence.</p></td> </tr><tr><td>[start]</td><td><code>number</code></td><td><p>The index of the start of the corresponding entity in the sentence.</p></td> </tr><tr><td>[end]</td><td><code>number</code></td><td><p>The index of the end of the corresponding entity in the sentence.</p></td> </tr><tr><td>[ignore_labels]</td><td><code>Array.&lt;string&gt;</code></td><td><p>A list of labels to ignore.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..QuestionAnsweringPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesquestionansweringpipelinetype--code-promise--questionansweringoutputarray--questionansweringoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesquestionansweringpipelinetype--code-promise--questionansweringoutputarray--questionansweringoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~QuestionAnsweringPipelineType ⇒ &lt;code> Promise. &lt; (QuestionAnsweringOutput|Array &lt; QuestionAnsweringOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-1vedd0s">Parameters specific to question answering pipelines.</p> <p data-svelte-h="svelte-2lvzw0"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(QuestionAnsweringOutput|Array&lt;QuestionAnsweringOutput&gt;)&gt;</code> - An array or object containing the predicted answers and scores.</p> <table data-svelte-h="svelte-1bpmr33"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>question</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>One or several question(s) (must be used in conjunction with the <code>context</code> argument).</p></td> </tr><tr><td>context</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>One or several context(s) associated with the question(s) (must be used in conjunction with the <code>question</code> argument).</p></td> </tr><tr><td>[options]</td><td><code>QuestionAnsweringPipelineOptions</code></td><td><p>The options to use for question answering.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-1era92"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>score</td><td><code>number</code></td><td></td><td><p>The probability associated to the answer.</p></td> </tr><tr><td>[start]</td><td><code>number</code></td><td></td><td><p>The character start index of the answer (in the tokenized version of the input).</p></td> </tr><tr><td>[end]</td><td><code>number</code></td><td></td><td><p>The character end index of the answer (in the tokenized version of the input).</p></td> </tr><tr><td>answer</td><td><code>string</code></td><td></td><td><p>The answer to the question.</p></td> </tr><tr><td>[top_k]</td><td><code>number</code></td><td><code>1</code></td><td><p>The number of top answer predictions to be returned.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..FillMaskPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesfillmaskpipelinetype--code-promise--fillmaskoutputarray--fillmaskoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesfillmaskpipelinetype--code-promise--fillmaskoutputarray--fillmaskoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~FillMaskPipelineType ⇒ &lt;code> Promise. &lt; (FillMaskOutput|Array &lt; FillMaskOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-c20v7t">Parameters specific to fill mask pipelines.</p> <p data-svelte-h="svelte-hjcayz"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(FillMaskOutput|Array&lt;FillMaskOutput&gt;)&gt;</code> - An array of objects containing the score, predicted token, predicted token string,
and the sequence with the predicted token filled in, or an array of such arrays (one for each input text).
If only one input text is given, the output will be an array of objects.<br> <strong>Throws</strong>:</p> <ul data-svelte-h="svelte-wmzf9w"><li><code>Error</code> When the mask token is not found in the input text.</li></ul> <table data-svelte-h="svelte-10st3qn"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>One or several texts (or one list of prompts) with masked tokens.</p></td> </tr><tr><td>[options]</td><td><code>FillMaskPipelineOptions</code></td><td><p>The options to use for masked language modelling.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-1isqyy1"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>sequence</td><td><code>string</code></td><td></td><td><p>The corresponding input with the mask token prediction.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>The corresponding probability.</p></td> </tr><tr><td>token</td><td><code>number</code></td><td></td><td><p>The predicted token id (to replace the masked one).</p></td> </tr><tr><td>token_str</td><td><code>string</code></td><td></td><td><p>The predicted token (to replace the masked one).</p></td> </tr><tr><td>[top_k]</td><td><code>number</code></td><td><code>5</code></td><td><p>When passed, overrides the number of predictions to return.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..Text2TextGenerationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinestext2textgenerationpipelinetype--code-promise--text2textgenerationoutputarray--text2textgenerationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestext2textgenerationpipelinetype--code-promise--text2textgenerationoutputarray--text2textgenerationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~Text2TextGenerationPipelineType ⇒ &lt;code> Promise. &lt; (Text2TextGenerationOutput|Array &lt; Text2TextGenerationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-1axcw5l"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a></p> <table data-svelte-h="svelte-wdzz5f"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>Input text for the encoder.</p></td> </tr><tr><td>[options]</td><td><code>*</code></td><td><p>Additional keyword arguments to pass along to the generate method of the model.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-jpm10y"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generated_text</td><td><code>string</code></td><td><p>The generated text.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..SummarizationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinessummarizationpipelinetype--code-promise--summarizationoutputarray--summarizationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinessummarizationpipelinetype--code-promise--summarizationoutputarray--summarizationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~SummarizationPipelineType ⇒ &lt;code> Promise. &lt; (SummarizationOutput|Array &lt; SummarizationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-1axcw5l"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a></p> <table data-svelte-h="svelte-um34lc"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>One or several articles (or one list of articles) to summarize.</p></td> </tr><tr><td>[options]</td><td><code>*</code></td><td><p>Additional keyword arguments to pass along to the generate method of the model.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-12o7o6m"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>summary_text</td><td><code>string</code></td><td><p>The summary text.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TranslationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinestranslationpipelinetype--code-promise--translationoutputarray--translationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestranslationpipelinetype--code-promise--translationoutputarray--translationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TranslationPipelineType ⇒ &lt;code> Promise. &lt; (TranslationOutput|Array &lt; TranslationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-1axcw5l"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a></p> <table data-svelte-h="svelte-2zn3c2"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>Texts to be translated.</p></td> </tr><tr><td>[options]</td><td><code>*</code></td><td><p>Additional keyword arguments to pass along to the generate method of the model.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-14fnfzf"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>translation_text</td><td><code>string</code></td><td><p>The translated text.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TextGenerationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinestextgenerationpipelinetype--code-promise--textgenerationoutputarray--textgenerationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestextgenerationpipelinetype--code-promise--textgenerationoutputarray--textgenerationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TextGenerationPipelineType ⇒ &lt;code> Promise. &lt; (TextGenerationOutput|Array &lt; TextGenerationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-1iiqv80">Parameters specific to text-generation pipelines.</p> <p data-svelte-h="svelte-127plg"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(TextGenerationOutput|Array&lt;TextGenerationOutput&gt;)&gt;</code> - An array or object containing the generated texts.</p> <table data-svelte-h="svelte-zz9utp"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code> | <code>Chat</code> | <code>Array&lt;Chat&gt;</code></td><td><p>One or several prompts (or one list of prompts) to complete.</p></td> </tr><tr><td>[options]</td><td><code>Partial.&lt;TextGenerationConfig&gt;</code></td><td><p>Additional keyword arguments to pass along to the generate method of the model.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-fwioke"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>generated_text</td><td><code>string</code> | <code>Chat</code></td><td></td><td><p>The generated text.</p></td> </tr><tr><td>[add_special_tokens]</td><td><code>boolean</code></td><td></td><td><p>Whether or not to add special tokens when tokenizing the sequences.</p></td> </tr><tr><td>[return_full_text]</td><td><code>boolean</code></td><td><code>true</code></td><td><p>If set to <code>false</code> only added text is returned, otherwise the full text is returned.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ZeroShotClassificationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotclassificationpipelinetype--code-promise--zeroshotclassificationoutputarray--zeroshotclassificationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotclassificationpipelinetype--code-promise--zeroshotclassificationoutputarray--zeroshotclassificationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ZeroShotClassificationPipelineType ⇒ &lt;code> Promise. &lt; (ZeroShotClassificationOutput|Array &lt; ZeroShotClassificationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-14robr1">Parameters specific to zero-shot classification pipelines.</p> <p data-svelte-h="svelte-v0oyxa"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(ZeroShotClassificationOutput|Array&lt;ZeroShotClassificationOutput&gt;)&gt;</code> - An array or object containing the predicted labels and scores.</p> <table data-svelte-h="svelte-1esamuv"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>The sequence(s) to classify, will be truncated if the model input is too large.</p></td> </tr><tr><td>candidate_labels</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>The set of possible class labels to classify each sequence into.
Can be a single label, a string of comma-separated labels, or a list of labels.</p></td> </tr><tr><td>[options]</td><td><code>ZeroShotClassificationPipelineOptions</code></td><td><p>The options to use for zero-shot classification.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-105ib2i"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>sequence</td><td><code>string</code></td><td></td><td><p>The sequence for which this is the output.</p></td> </tr><tr><td>labels</td><td><code>Array.&lt;string&gt;</code></td><td></td><td><p>The labels sorted by order of likelihood.</p></td> </tr><tr><td>scores</td><td><code>Array.&lt;number&gt;</code></td><td></td><td><p>The probabilities for each of the labels.</p></td> </tr><tr><td>[hypothesis_template]</td><td><code>string</code></td><td><code>&quot;&quot;This example is {}.&quot;&quot;</code></td><td><p>The template used to turn each
candidate label into an NLI-style hypothesis. The candidate label will replace the &amp;#123;} placeholder.</p></td> </tr><tr><td>[multi_label]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not multiple candidate labels can be true.
If <code>false</code>, the scores are normalized such that the sum of the label likelihoods for each sequence
is 1. If <code>true</code>, the labels are considered independent and probabilities are normalized for each
candidate by doing a softmax of the entailment score vs. the contradiction score.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..FeatureExtractionPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesfeatureextractionpipelinetype--code-promise--tensor--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesfeatureextractionpipelinetype--code-promise--tensor--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~FeatureExtractionPipelineType ⇒ &lt;code> Promise. &lt; Tensor > &lt;/code></span></h2> <p data-svelte-h="svelte-1g7now9">Parameters specific to feature extraction pipelines.</p> <p data-svelte-h="svelte-1d3dphs"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Promise.&lt;Tensor&gt;</code></a> - The features computed by the model.</p> <table data-svelte-h="svelte-1e229ag"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>One or several texts (or one list of texts) to get the features of.</p></td> </tr><tr><td>[options]</td><td><code>FeatureExtractionPipelineOptions</code></td><td><p>The options to use for feature extraction.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-k6x8ku"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>[pooling]</td><td><code>&#39;none&#39;</code> | <code>&#39;mean&#39;</code> | <code>&#39;cls&#39;</code></td><td><code>&quot;none&quot;</code></td><td><p>The pooling method to use.</p></td> </tr><tr><td>[normalize]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to normalize the embeddings in the last dimension.</p></td> </tr><tr><td>[quantize]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether or not to quantize the embeddings.</p></td> </tr><tr><td>[precision]</td><td><code>&#39;binary&#39;</code> | <code>&#39;ubinary&#39;</code></td><td><code>&#39;binary&#39;</code></td><td><p>The precision to use for quantization.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ImageFeatureExtractionPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesimagefeatureextractionpipelinetype--code-promise--tensor--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagefeatureextractionpipelinetype--code-promise--tensor--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ImageFeatureExtractionPipelineType ⇒ &lt;code> Promise. &lt; Tensor > &lt;/code></span></h2> <p data-svelte-h="svelte-1j7a9hq">Parameters specific to image feature extraction pipelines.</p> <p data-svelte-h="svelte-o60zvb"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <a href="#Tensor"><code>Promise.&lt;Tensor&gt;</code></a> - The image features computed by the model.</p> <table data-svelte-h="svelte-1ij1nih"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>One or several images (or one list of images) to get the features of.</p></td> </tr><tr><td>[options]</td><td><code>ImageFeatureExtractionPipelineOptions</code></td><td><p>The options to use for image feature extraction.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-4g6d9h"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>[pool]</td><td><code>boolean</code></td><td><code></code></td><td><p>Whether or not to return the pooled output. If set to <code>false</code>, the model will return the raw hidden states.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..AudioClassificationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesaudioclassificationpipelinetype--code-promise--audioclassificationoutputarray--audioclassificationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesaudioclassificationpipelinetype--code-promise--audioclassificationoutputarray--audioclassificationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~AudioClassificationPipelineType ⇒ &lt;code> Promise. &lt; (AudioClassificationOutput|Array &lt; AudioClassificationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-zg073o">Parameters specific to audio classification pipelines.</p> <p data-svelte-h="svelte-1p0pjr6"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(AudioClassificationOutput|Array&lt;AudioClassificationOutput&gt;)&gt;</code> - An array or object containing the predicted labels and scores.</p> <table data-svelte-h="svelte-1fnbyk"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>audio</td><td><code>AudioPipelineInputs</code></td><td><p>The input audio file(s) to be classified. The input is either:</p> <ul><li><code>string</code> or <code>URL</code> that is the filename/URL of the audio file, the file will be read at the processor&#39;s sampling rate
to get the waveform using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/AudioContext"><code>AudioContext</code></a> API.
If <code>AudioContext</code> is not available, you should pass the raw waveform in as a Float32Array of shape <code>(n, )</code>.</li> <li><code>Float32Array</code> or <code>Float64Array</code> of shape <code>(n, )</code>, representing the raw audio at the correct sampling rate (no further check will be done).</li></ul></td> </tr><tr><td>[options]</td><td><code>AudioClassificationPipelineOptions</code></td><td><p>The options to use for audio classification.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-ovxjoy"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>The label predicted.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>The corresponding probability.</p></td> </tr><tr><td>[top_k]</td><td><code>number</code></td><td><code>5</code></td><td><p>The number of top labels that will be returned by the pipeline.
If the provided number is <code>null</code> or higher than the number of labels available in the model configuration,
it will default to the number of labels.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ZeroShotAudioClassificationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotaudioclassificationpipelinetype--code-promise--array--zeroshotaudioclassificationoutput--array--array--zeroshotaudioclassificationoutput-----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotaudioclassificationpipelinetype--code-promise--array--zeroshotaudioclassificationoutput--array--array--zeroshotaudioclassificationoutput-----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ZeroShotAudioClassificationPipelineType ⇒ &lt;code> Promise. &lt; (Array &lt; ZeroShotAudioClassificationOutput > |Array &lt; Array &lt; ZeroShotAudioClassificationOutput > > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-uiu8uf">Parameters specific to zero-shot audio classification pipelines.</p> <p data-svelte-h="svelte-1rznspb"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(Array&lt;ZeroShotAudioClassificationOutput&gt;|Array&lt;Array&lt;ZeroShotAudioClassificationOutput&gt;&gt;)&gt;</code> - An array of objects containing the predicted labels and scores.</p> <table data-svelte-h="svelte-1t7i0jv"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>audio</td><td><code>AudioPipelineInputs</code></td><td><p>The input audio file(s) to be classified. The input is either:</p> <ul><li><code>string</code> or <code>URL</code> that is the filename/URL of the audio file, the file will be read at the processor&#39;s sampling rate
to get the waveform using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/AudioContext"><code>AudioContext</code></a> API.
If <code>AudioContext</code> is not available, you should pass the raw waveform in as a Float32Array of shape <code>(n, )</code>.</li> <li><code>Float32Array</code> or <code>Float64Array</code> of shape <code>(n, )</code>, representing the raw audio at the correct sampling rate (no further check will be done).</li></ul></td> </tr><tr><td>candidate_labels</td><td><code>Array.&lt;string&gt;</code></td><td><p>The candidate labels for this audio.</p></td> </tr><tr><td>[options]</td><td><code>ZeroShotAudioClassificationPipelineOptions</code></td><td><p>The options to use for zero-shot audio classification.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-1vg0xo5"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>The label identified by the model. It is one of the suggested <code>candidate_label</code>.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>The score attributed by the model for that label (between 0 and 1).</p></td> </tr><tr><td>[hypothesis_template]</td><td><code>string</code></td><td><code>&quot;&quot;This is a sound of {}.&quot;&quot;</code></td><td><p>The sentence used in conjunction with <code>candidate_labels</code>
to attempt the audio classification by replacing the placeholder with the candidate_labels.
Then likelihood is estimated by using <code>logits_per_audio</code>.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..Chunk" class="group"></a> <h2 class="relative group"><a id="pipelineschunk--code-object-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineschunk--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~Chunk : &lt;code> Object &lt;/code></span></h2> <p data-svelte-h="svelte-ptv3i7"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Properties</strong></p> <table data-svelte-h="svelte-iwz8lt"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>timestamp</td><td><code>*</code></td><td><p>The start and end timestamp of the chunk in seconds.</p></td> </tr><tr><td>text</td><td><code>string</code></td><td><p>The recognized text.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..AutomaticSpeechRecognitionPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesautomaticspeechrecognitionpipelinetype--code-promise--automaticspeechrecognitionoutputarray--automaticspeechrecognitionoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesautomaticspeechrecognitionpipelinetype--code-promise--automaticspeechrecognitionoutputarray--automaticspeechrecognitionoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~AutomaticSpeechRecognitionPipelineType ⇒ &lt;code> Promise. &lt; (AutomaticSpeechRecognitionOutput|Array &lt; AutomaticSpeechRecognitionOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-2ut6tw">Parameters specific to automatic-speech-recognition pipelines.</p> <p data-svelte-h="svelte-1mwkilo"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(AutomaticSpeechRecognitionOutput|Array&lt;AutomaticSpeechRecognitionOutput&gt;)&gt;</code> - An object containing the transcription text and optionally timestamps if <code>return_timestamps</code> is <code>true</code>.</p> <table data-svelte-h="svelte-1m5w484"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>audio</td><td><code>AudioPipelineInputs</code></td><td><p>The input audio file(s) to be transcribed. The input is either:</p> <ul><li><code>string</code> or <code>URL</code> that is the filename/URL of the audio file, the file will be read at the processor&#39;s sampling rate
to get the waveform using the <a href="https://developer.mozilla.org/en-US/docs/Web/API/AudioContext"><code>AudioContext</code></a> API.
If <code>AudioContext</code> is not available, you should pass the raw waveform in as a Float32Array of shape <code>(n, )</code>.</li> <li><code>Float32Array</code> or <code>Float64Array</code> of shape <code>(n, )</code>, representing the raw audio at the correct sampling rate (no further check will be done).</li></ul></td> </tr><tr><td>[options]</td><td><code>Partial.&lt;AutomaticSpeechRecognitionConfig&gt;</code></td><td><p>Additional keyword arguments to pass along to the generate method of the model.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-h3w38e"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>text</td><td><code>string</code></td><td><p>The recognized text.</p></td> </tr><tr><td>[chunks]</td><td><code>Array.&lt;Chunk&gt;</code></td><td><p>When using <code>return_timestamps</code>, the <code>chunks</code> will become a list
containing all the various text chunks identified by the model.</p></td> </tr><tr><td>[return_timestamps]</td><td><code>boolean</code> | <code>&#39;word&#39;</code></td><td><p>Whether to return timestamps or not. Default is <code>false</code>.</p></td> </tr><tr><td>[chunk_length_s]</td><td><code>number</code></td><td><p>The length of audio chunks to process in seconds. Default is 0 (no chunking).</p></td> </tr><tr><td>[stride_length_s]</td><td><code>number</code></td><td><p>The length of overlap between consecutive audio chunks in seconds. If not provided, defaults to <code>chunk_length_s / 6</code>.</p></td> </tr><tr><td>[force_full_sequences]</td><td><code>boolean</code></td><td><p>Whether to force outputting full sequences or not. Default is <code>false</code>.</p></td> </tr><tr><td>[language]</td><td><code>string</code></td><td><p>The source language. Default is <code>null</code>, meaning it should be auto-detected. Use this to potentially improve performance if the source language is known.</p></td> </tr><tr><td>[task]</td><td><code>string</code></td><td><p>The task to perform. Default is <code>null</code>, meaning it should be auto-detected.</p></td> </tr><tr><td>[num_frames]</td><td><code>number</code></td><td><p>The number of frames in the input audio.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ImageToTextPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesimagetotextpipelinetype--code-promise--imagetotextoutputarray--imagetotextoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagetotextpipelinetype--code-promise--imagetotextoutputarray--imagetotextoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ImageToTextPipelineType ⇒ &lt;code> Promise. &lt; (ImageToTextOutput|Array &lt; ImageToTextOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-d49qij"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(ImageToTextOutput|Array&lt;ImageToTextOutput&gt;)&gt;</code> - An object (or array of objects) containing the generated text(s).</p> <table data-svelte-h="svelte-ygxxf5"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>ImagePipelineInputs</code></td><td><p>The images to be captioned.</p></td> </tr><tr><td>[options]</td><td><code>*</code></td><td><p>Additional keyword arguments to pass along to the generate method of the model.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-jpm10y"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>generated_text</td><td><code>string</code></td><td><p>The generated text.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ImageClassificationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesimageclassificationpipelinetype--code-promise--imageclassificationoutputarray--imageclassificationoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimageclassificationpipelinetype--code-promise--imageclassificationoutputarray--imageclassificationoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ImageClassificationPipelineType ⇒ &lt;code> Promise. &lt; (ImageClassificationOutput|Array &lt; ImageClassificationOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-10azskl">Parameters specific to image classification pipelines.</p> <p data-svelte-h="svelte-1bdsbsy"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(ImageClassificationOutput|Array&lt;ImageClassificationOutput&gt;)&gt;</code> - An array or object containing the predicted labels and scores.</p> <table data-svelte-h="svelte-1rcn5yv"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>The input images(s) to be classified.</p></td> </tr><tr><td>[options]</td><td><code>ImageClassificationPipelineOptions</code></td><td><p>The options to use for image classification.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-ny1oa1"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>The label identified by the model.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>The score attributed by the model for that label.</p></td> </tr><tr><td>[top_k]</td><td><code>number</code></td><td><code>1</code></td><td><p>The number of top labels that will be returned by the pipeline.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ImageSegmentationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesimagesegmentationpipelinetype--code-promise--array--imagesegmentationpipelineoutput---code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagesegmentationpipelinetype--code-promise--array--imagesegmentationpipelineoutput---code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ImageSegmentationPipelineType ⇒ &lt;code> Promise. &lt; Array &lt; ImageSegmentationPipelineOutput > > &lt;/code></span></h2> <p data-svelte-h="svelte-1jdk7q7">Parameters specific to image segmentation pipelines.</p> <p data-svelte-h="svelte-17rpkxy"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;Array&lt;ImageSegmentationPipelineOutput&gt;&gt;</code> - The annotated segments.</p> <table data-svelte-h="svelte-12zqzt2"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>The input images.</p></td> </tr><tr><td>[options]</td><td><code>ImageSegmentationPipelineOptions</code></td><td><p>The options to use for image segmentation.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-jxx1jt"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>The label of the segment.</p></td> </tr><tr><td>score</td><td><code>number</code> | <code>null</code></td><td></td><td><p>The score of the segment.</p></td> </tr><tr><td>mask</td><td><code><a href="#RawImage">RawImage</a></code></td><td></td><td><p>The mask of the segment.</p></td> </tr><tr><td>[threshold]</td><td><code>number</code></td><td><code>0.5</code></td><td><p>Probability threshold to filter out predicted masks.</p></td> </tr><tr><td>[mask_threshold]</td><td><code>number</code></td><td><code>0.5</code></td><td><p>Threshold to use when turning the predicted masks into binary values.</p></td> </tr><tr><td>[overlap_mask_area_threshold]</td><td><code>number</code></td><td><code>0.8</code></td><td><p>Mask overlap threshold to eliminate small, disconnected segments.</p></td> </tr><tr><td>[subtask]</td><td><code>null</code> | <code>string</code></td><td><code></code></td><td><p>Segmentation task to be performed. One of [<code>panoptic</code>, <code>instance</code>, and <code>semantic</code>],
depending on model capabilities. If not set, the pipeline will attempt to resolve (in that order).</p></td> </tr><tr><td>[label_ids_to_fuse]</td><td><code>Array.&lt;number&gt;</code></td><td><code></code></td><td><p>List of label ids to fuse. If not set, do not fuse any labels.</p></td> </tr><tr><td>[target_sizes]</td><td><code>Array.&lt;Array&lt;number&gt;&gt;</code></td><td><code></code></td><td><p>List of target sizes for the input images. If not set, use the original image sizes.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ZeroShotImageClassificationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotimageclassificationpipelinetype--code-promise--array--zeroshotimageclassificationoutput--array--array--zeroshotimageclassificationoutput-----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotimageclassificationpipelinetype--code-promise--array--zeroshotimageclassificationoutput--array--array--zeroshotimageclassificationoutput-----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ZeroShotImageClassificationPipelineType ⇒ &lt;code> Promise. &lt; (Array &lt; ZeroShotImageClassificationOutput > |Array &lt; Array &lt; ZeroShotImageClassificationOutput > > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-61xmb6">Parameters specific to zero-shot image classification pipelines.</p> <p data-svelte-h="svelte-1c819p5"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(Array&lt;ZeroShotImageClassificationOutput&gt;|Array&lt;Array&lt;ZeroShotImageClassificationOutput&gt;&gt;)&gt;</code> - An array of objects containing the predicted labels and scores.</p> <table data-svelte-h="svelte-1ql6xpw"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>The input images.</p></td> </tr><tr><td>candidate_labels</td><td><code>Array.&lt;string&gt;</code></td><td><p>The candidate labels for this image.</p></td> </tr><tr><td>[options]</td><td><code>ZeroShotImageClassificationPipelineOptions</code></td><td><p>The options to use for zero-shot image classification.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-14miuwu"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>The label identified by the model. It is one of the suggested <code>candidate_label</code>.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>The score attributed by the model for that label (between 0 and 1).</p></td> </tr><tr><td>[hypothesis_template]</td><td><code>string</code></td><td><code>&quot;&quot;This is a photo of {}&quot;&quot;</code></td><td><p>The sentence used in conjunction with <code>candidate_labels</code>
to attempt the image classification by replacing the placeholder with the candidate_labels.
Then likelihood is estimated by using <code>logits_per_image</code>.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ObjectDetectionPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesobjectdetectionpipelinetype--code-promise--objectdetectionpipelineoutputarray--objectdetectionpipelineoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesobjectdetectionpipelinetype--code-promise--objectdetectionpipelineoutputarray--objectdetectionpipelineoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ObjectDetectionPipelineType ⇒ &lt;code> Promise. &lt; (ObjectDetectionPipelineOutput|Array &lt; ObjectDetectionPipelineOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-4x8tbi">Parameters specific to object detection pipelines.</p> <p data-svelte-h="svelte-148mxfe"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(ObjectDetectionPipelineOutput|Array&lt;ObjectDetectionPipelineOutput&gt;)&gt;</code> - A list of objects or a list of list of objects.</p> <table data-svelte-h="svelte-nx9uxw"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>The input images.</p></td> </tr><tr><td>[options]</td><td><code>ObjectDetectionPipelineOptions</code></td><td><p>The options to use for object detection.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-20m6rc"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>The class label identified by the model.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>The score attributed by the model for that label.</p></td> </tr><tr><td>box</td><td><code>BoundingBox</code></td><td></td><td><p>The bounding box of detected object in image&#39;s original size, or as a percentage if <code>percentage</code> is set to true.</p></td> </tr><tr><td>[threshold]</td><td><code>number</code></td><td><code>0.9</code></td><td><p>The threshold used to filter boxes by score.</p></td> </tr><tr><td>[percentage]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether to return the boxes coordinates in percentage (true) or in pixels (false).</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ZeroShotObjectDetectionPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelineszeroshotobjectdetectionpipelinetype--code-promise--array--zeroshotobjectdetectionoutput--array--array--zeroshotobjectdetectionoutput-----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelineszeroshotobjectdetectionpipelinetype--code-promise--array--zeroshotobjectdetectionoutput--array--array--zeroshotobjectdetectionoutput-----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ZeroShotObjectDetectionPipelineType ⇒ &lt;code> Promise. &lt; (Array &lt; ZeroShotObjectDetectionOutput > |Array &lt; Array &lt; ZeroShotObjectDetectionOutput > > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-ficm91">Parameters specific to zero-shot object detection pipelines.</p> <p data-svelte-h="svelte-1886dy0"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(Array&lt;ZeroShotObjectDetectionOutput&gt;|Array&lt;Array&lt;ZeroShotObjectDetectionOutput&gt;&gt;)&gt;</code> - An array of objects containing the predicted labels, scores, and bounding boxes.</p> <table data-svelte-h="svelte-hp09xx"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>The input images.</p></td> </tr><tr><td>candidate_labels</td><td><code>Array.&lt;string&gt;</code></td><td><p>What the model should recognize in the image.</p></td> </tr><tr><td>[options]</td><td><code>ZeroShotObjectDetectionPipelineOptions</code></td><td><p>The options to use for zero-shot object detection.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-1ev2uof"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>label</td><td><code>string</code></td><td></td><td><p>Text query corresponding to the found object.</p></td> </tr><tr><td>score</td><td><code>number</code></td><td></td><td><p>Score corresponding to the object (between 0 and 1).</p></td> </tr><tr><td>box</td><td><code>BoundingBox</code></td><td></td><td><p>Bounding box of the detected object in image&#39;s original size, or as a percentage if <code>percentage</code> is set to true.</p></td> </tr><tr><td>[threshold]</td><td><code>number</code></td><td><code>0.1</code></td><td><p>The probability necessary to make a prediction.</p></td> </tr><tr><td>[top_k]</td><td><code>number</code></td><td><code></code></td><td><p>The number of top predictions that will be returned by the pipeline.
If the provided number is <code>null</code> or higher than the number of predictions available, it will default
to the number of predictions.</p></td> </tr><tr><td>[percentage]</td><td><code>boolean</code></td><td><code>false</code></td><td><p>Whether to return the boxes coordinates in percentage (true) or in pixels (false).</p></td></tr></tbody></table> <hr> <a id="module_pipelines..DocumentQuestionAnsweringPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesdocumentquestionansweringpipelinetype--code-promise--documentquestionansweringoutputarray--documentquestionansweringoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesdocumentquestionansweringpipelinetype--code-promise--documentquestionansweringoutputarray--documentquestionansweringoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~DocumentQuestionAnsweringPipelineType ⇒ &lt;code> Promise. &lt; (DocumentQuestionAnsweringOutput|Array &lt; DocumentQuestionAnsweringOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-towoux"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(DocumentQuestionAnsweringOutput|Array&lt;DocumentQuestionAnsweringOutput&gt;)&gt;</code> - An object (or array of objects) containing the answer(s).</p> <table data-svelte-h="svelte-196k7qb"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>image</td><td><code>ImageInput</code></td><td><p>The image of the document to use.</p></td> </tr><tr><td>question</td><td><code>string</code></td><td><p>A question to ask of the document.</p></td> </tr><tr><td>[options]</td><td><code>*</code></td><td><p>Additional keyword arguments to pass along to the generate method of the model.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-14s1ibx"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>answer</td><td><code>string</code></td><td><p>The generated text.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TextToAudioPipelineConstructorArgs" class="group"></a> <h2 class="relative group"><a id="pipelinestexttoaudiopipelineconstructorargs--code-object-code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestexttoaudiopipelineconstructorargs--code-object-code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TextToAudioPipelineConstructorArgs : &lt;code> Object &lt;/code></span></h2> <p data-svelte-h="svelte-ptv3i7"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Properties</strong></p> <table data-svelte-h="svelte-10h9uf2"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>[vocoder]</td><td><code>PreTrainedModel</code></td><td><p>The vocoder used by the pipeline (if the model uses one). If not provided, use the default HifiGan vocoder.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..TextToAudioPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinestexttoaudiopipelinetype--code-promise--texttoaudiooutput--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinestexttoaudiopipelinetype--code-promise--texttoaudiooutput--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~TextToAudioPipelineType ⇒ &lt;code> Promise. &lt; TextToAudioOutput > &lt;/code></span></h2> <p data-svelte-h="svelte-e3q3ck">Parameters specific to text-to-audio pipelines.</p> <p data-svelte-h="svelte-djs0r5"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;TextToAudioOutput&gt;</code> - An object containing the generated audio and sampling rate.</p> <table data-svelte-h="svelte-1tcwp3s"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>texts</td><td><code>string</code> | <code>Array&lt;string&gt;</code></td><td><p>The text(s) to generate.</p></td> </tr><tr><td>options</td><td><code>TextToAudioPipelineOptions</code></td><td><p>Parameters passed to the model generation/forward method.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-1c1ugfn"><thead><tr><th>Name</th><th>Type</th><th>Default</th><th>Description</th></tr></thead> <tbody><tr><td>audio</td><td><code>Float32Array</code></td><td></td><td><p>The generated audio waveform.</p></td> </tr><tr><td>sampling_rate</td><td><code>number</code></td><td></td><td><p>The sampling rate of the generated audio waveform.</p></td> </tr><tr><td>[speaker_embeddings]</td><td><code><a href="#Tensor">Tensor</a></code> | <code>Float32Array</code> | <code>string</code> | <code>URL</code></td><td><code></code></td><td><p>The speaker embeddings (if the model requires it).</p></td></tr></tbody></table> <hr> <a id="module_pipelines..ImageToImagePipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesimagetoimagepipelinetype--code-promise--rawimagearray--rawimage----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesimagetoimagepipelinetype--code-promise--rawimagearray--rawimage----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~ImageToImagePipelineType ⇒ &lt;code> Promise. &lt; (RawImage|Array &lt; RawImage > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-qri2bt"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(RawImage|Array&lt;RawImage&gt;)&gt;</code> - The transformed image or list of images.</p> <table data-svelte-h="svelte-1a5japr"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>The images to transform.</p></td></tr></tbody></table> <hr> <a id="module_pipelines..DepthEstimationPipelineType" class="group"></a> <h2 class="relative group"><a id="pipelinesdepthestimationpipelinetype--code-promise--depthestimationpipelineoutputarray--depthestimationpipelineoutput----code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesdepthestimationpipelinetype--code-promise--depthestimationpipelineoutputarray--depthestimationpipelineoutput----code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~DepthEstimationPipelineType ⇒ &lt;code> Promise. &lt; (DepthEstimationPipelineOutput|Array &lt; DepthEstimationPipelineOutput > ) > &lt;/code></span></h2> <p data-svelte-h="svelte-1h3fxm6"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a><br> <strong>Returns</strong>: <code>Promise.&lt;(DepthEstimationPipelineOutput|Array&lt;DepthEstimationPipelineOutput&gt;)&gt;</code> - An image or a list of images containing result(s).</p> <table data-svelte-h="svelte-15hpala"><thead><tr><th>Param</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>images</td><td><code>ImagePipelineInputs</code></td><td><p>The images to compute depth for.</p></td></tr></tbody></table> <p data-svelte-h="svelte-drbxoe"><strong>Properties</strong></p> <table data-svelte-h="svelte-3tu74i"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead> <tbody><tr><td>predicted_depth</td><td><code><a href="#Tensor">Tensor</a></code></td><td><p>The raw depth map predicted by the model.</p></td> </tr><tr><td>depth</td><td><code><a href="#RawImage">RawImage</a></code></td><td><p>The processed depth map as an image (with the same size as the input image).</p></td></tr></tbody></table> <hr> <a id="module_pipelines..AllTasks" class="group"></a> <h2 class="relative group"><a id="pipelinesalltasks--code--code" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#pipelinesalltasks--code--code"><span><svg class="" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg></span></a> <span>pipelines~AllTasks : &lt;code> * &lt;/code></span></h2> <p data-svelte-h="svelte-1r368bj">All possible pipeline types.</p> <p data-svelte-h="svelte-1axcw5l"><strong>Kind</strong>: inner typedef of <a href="#module_pipelines"><code>pipelines</code></a></p> <hr> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/transformers.js/blob/main/docs/source/api/pipelines.md" target="_blank"><span data-svelte-h="svelte-1kd6by1">&lt;</span> <span data-svelte-h="svelte-x0xyl0">&gt;</span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p>
<script>
{
__sveltekit_kuyevp = {
assets: "/docs/transformers.js/pr_1113/en",
base: "/docs/transformers.js/pr_1113/en",
env: {}
};
const element = document.currentScript.parentElement;
const data = [null,null];
Promise.all([
import("/docs/transformers.js/pr_1113/en/_app/immutable/entry/start.88a6e140.js"),
import("/docs/transformers.js/pr_1113/en/_app/immutable/entry/app.0003020d.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 12],
data,
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
425 kB
·
Xet hash:
f3f001be6961bf3e6498c6446e5f709ad04897ed2007c14020abfc3db06215d8

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.