Huggingface.js documentation

Class: HfInference

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Class: HfInference

For backward compatibility only.

Hierarchy

Constructors

constructor

new HfInference(accessToken?, defaultOptions?): HfInference

Parameters

Name Type Default value
accessToken string ""
defaultOptions Options {}

Returns

HfInference

Inherited from

InferenceClient.constructor

Defined in

inference/src/InferenceClient.ts:28

Properties

audioClassification

audioClassification: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options) => Promise\<AudioClassificationOutput>

Type declaration

▸ (args, options?): Promise\<AudioClassificationOutput>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options
Returns

Promise\<AudioClassificationOutput>

Inherited from

InferenceClient.audioClassification

Defined in

inference/src/tasks/audio/audioClassification.ts:14


audioToAudio

audioToAudio: (args: { data: Blob | ArrayBuffer } | { endpointUrl?: string ; inputs: Blob ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" }, options?: Options) => Promise\<AudioToAudioOutput[]>

Type declaration

▸ (args, options?): Promise\<AudioToAudioOutput[]>

Parameters
Name Type
args { data: Blob | ArrayBuffer } | { endpointUrl?: string ; inputs: Blob ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" }
options? Options
Returns

Promise\<AudioToAudioOutput[]>

Inherited from

InferenceClient.audioToAudio

Defined in

inference/src/tasks/audio/audioToAudio.ts:38


automaticSpeechRecognition

automaticSpeechRecognition: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options) => Promise\<AutomaticSpeechRecognitionOutput>

Type declaration

▸ (args, options?): Promise\<AutomaticSpeechRecognitionOutput>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options
Returns

Promise\<AutomaticSpeechRecognitionOutput>

Inherited from

InferenceClient.automaticSpeechRecognition

Defined in

inference/src/tasks/audio/automaticSpeechRecognition.ts:15


chatCompletion

chatCompletion: (args: {}, options?: Options) => Promise\<ChatCompletionOutput>

Type declaration

▸ (args, options?): Promise\<ChatCompletionOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<ChatCompletionOutput>

Inherited from

InferenceClient.chatCompletion

Defined in

inference/src/tasks/nlp/chatCompletion.ts:9


chatCompletionStream

chatCompletionStream: (args: {}, options?: Options) => AsyncGenerator\<ChatCompletionStreamOutput, any, unknown>

Type declaration

▸ (args, options?): AsyncGenerator\<ChatCompletionStreamOutput, any, unknown>

Parameters
Name Type
args Object
options? Options
Returns

AsyncGenerator\<ChatCompletionStreamOutput, any, unknown>

Inherited from

InferenceClient.chatCompletionStream

Defined in

inference/src/tasks/nlp/chatCompletionStream.ts:8


documentQuestionAnswering

documentQuestionAnswering: (args: {}, options?: Options) => Promise\<DocumentQuestionAnsweringOutputElement>

Type declaration

▸ (args, options?): Promise\<DocumentQuestionAnsweringOutputElement>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<DocumentQuestionAnsweringOutputElement>

Inherited from

InferenceClient.documentQuestionAnswering

Defined in

inference/src/tasks/multimodal/documentQuestionAnswering.ts:20


featureExtraction

featureExtraction: (args: {}, options?: Options) => Promise\<FeatureExtractionOutput>

Type declaration

▸ (args, options?): Promise\<FeatureExtractionOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<FeatureExtractionOutput>

Inherited from

InferenceClient.featureExtraction

Defined in

inference/src/tasks/nlp/featureExtraction.ts:16


fillMask

fillMask: (args: {}, options?: Options) => Promise\<FillMaskOutput>

Type declaration

▸ (args, options?): Promise\<FillMaskOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<FillMaskOutput>

Inherited from

InferenceClient.fillMask

Defined in

inference/src/tasks/nlp/fillMask.ts:11


imageClassification

imageClassification: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options) => Promise\<ImageClassificationOutput>

Type declaration

▸ (args, options?): Promise\<ImageClassificationOutput>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options
Returns

Promise\<ImageClassificationOutput>

Inherited from

InferenceClient.imageClassification

Defined in

inference/src/tasks/cv/imageClassification.ts:13


imageSegmentation

imageSegmentation: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options) => Promise\<ImageSegmentationOutput>

Type declaration

▸ (args, options?): Promise\<ImageSegmentationOutput>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options
Returns

Promise\<ImageSegmentationOutput>

Inherited from

InferenceClient.imageSegmentation

Defined in

inference/src/tasks/cv/imageSegmentation.ts:13


imageToImage

imageToImage: (args: {}, options?: Options) => Promise\<Blob>

Type declaration

▸ (args, options?): Promise\<Blob>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<Blob>

Inherited from

InferenceClient.imageToImage

Defined in

inference/src/tasks/cv/imageToImage.ts:13


imageToText

imageToText: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options) => Promise\<ImageToTextOutput>

Type declaration

▸ (args, options?): Promise\<ImageToTextOutput>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options
Returns

Promise\<ImageToTextOutput>

Inherited from

InferenceClient.imageToText

Defined in

inference/src/tasks/cv/imageToText.ts:12


objectDetection

objectDetection: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options) => Promise\<ObjectDetectionOutput>

Type declaration

▸ (args, options?): Promise\<ObjectDetectionOutput>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options
Returns

Promise\<ObjectDetectionOutput>

Inherited from

InferenceClient.objectDetection

Defined in

inference/src/tasks/cv/objectDetection.ts:13


questionAnswering

questionAnswering: (args: {}, options?: Options) => Promise\<QuestionAnsweringOutputElement>

Type declaration

▸ (args, options?): Promise\<QuestionAnsweringOutputElement>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<QuestionAnsweringOutputElement>

Inherited from

InferenceClient.questionAnswering

Defined in

inference/src/tasks/nlp/questionAnswering.ts:11


request

request: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; inputs: unknown ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; prompt: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" ; text: string } | { audio_url: string ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options & { chatCompletion?: boolean ; task?: InferenceTask }) => Promise\<unknown>

Type declaration

▸ (args, options?): Promise\<unknown>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; inputs: unknown ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; prompt: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" ; text: string } | { audio_url: string ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options & { chatCompletion?: boolean ; task?: InferenceTask }
Returns

Promise\<unknown>

Inherited from

InferenceClient.request

Defined in

inference/src/tasks/custom/request.ts:7


sentenceSimilarity

sentenceSimilarity: (args: {}, options?: Options) => Promise\<SentenceSimilarityOutput>

Type declaration

▸ (args, options?): Promise\<SentenceSimilarityOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<SentenceSimilarityOutput>

Inherited from

InferenceClient.sentenceSimilarity

Defined in

inference/src/tasks/nlp/sentenceSimilarity.ts:12


streamingRequest

streamingRequest: (args: { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; inputs: unknown ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; prompt: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" ; text: string } | { audio_url: string ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options & { chatCompletion?: boolean ; task?: InferenceTask }) => AsyncGenerator\<unknown, any, unknown>

Type declaration

▸ (args, options?): AsyncGenerator\<unknown, any, unknown>

Parameters
Name Type
args { data: Blob | ArrayBuffer ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; inputs: unknown ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; prompt: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | { endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" ; text: string } | { audio_url: string ; endpointUrl?: string ; model?: string ; parameters?: Record\<string, unknown> ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options & { chatCompletion?: boolean ; task?: InferenceTask }
Returns

AsyncGenerator\<unknown, any, unknown>

Inherited from

InferenceClient.streamingRequest

Defined in

inference/src/tasks/custom/streamingRequest.ts:9


summarization

summarization: (args: {}, options?: Options) => Promise\<SummarizationOutput>

Type declaration

▸ (args, options?): Promise\<SummarizationOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<SummarizationOutput>

Inherited from

InferenceClient.summarization

Defined in

inference/src/tasks/nlp/summarization.ts:11


tableQuestionAnswering

tableQuestionAnswering: (args: {}, options?: Options) => Promise\<TableQuestionAnsweringOutputElement>

Type declaration

▸ (args, options?): Promise\<TableQuestionAnsweringOutputElement>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<TableQuestionAnsweringOutputElement>

Inherited from

InferenceClient.tableQuestionAnswering

Defined in

inference/src/tasks/nlp/tableQuestionAnswering.ts:11


tabularClassification

tabularClassification: (args: { endpointUrl?: string ; inputs: { data: Record\<string, string[]> } ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" }, options?: Options) => Promise\<TabularClassificationOutput>

Type declaration

▸ (args, options?): Promise\<TabularClassificationOutput>

Parameters
Name Type Description
args Object -
args.endpointUrl? string The URL of the endpoint to use. If not specified, will call huggingface.co/api/tasks to get the default endpoint for the task. If specified, will use this URL instead of the default one.
args.inputs Object -
args.inputs.data Record\<string, string[]> A table of data represented as a dict of list where entries are headers and the lists are all the values, all lists must have the same size.
args.model? string The HF model to use. If not specified, will call huggingface.co/api/tasks to get the default model for the task. /!\ Legacy behavior allows this to be an URL, but this is deprecated and will be removed in the future. Use the endpointUrl parameter instead.
args.provider? "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" Set an Inference provider to run this model on. Defaults to the first provider in your user settings that is compatible with this model.
options? Options -
Returns

Promise\<TabularClassificationOutput>

Inherited from

InferenceClient.tabularClassification

Defined in

inference/src/tasks/tabular/tabularClassification.ts:24


tabularRegression

tabularRegression: (args: { endpointUrl?: string ; inputs: { data: Record\<string, string[]> } ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" }, options?: Options) => Promise\<TabularRegressionOutput>

Type declaration

▸ (args, options?): Promise\<TabularRegressionOutput>

Parameters
Name Type Description
args Object -
args.endpointUrl? string The URL of the endpoint to use. If not specified, will call huggingface.co/api/tasks to get the default endpoint for the task. If specified, will use this URL instead of the default one.
args.inputs Object -
args.inputs.data Record\<string, string[]> A table of data represented as a dict of list where entries are headers and the lists are all the values, all lists must have the same size.
args.model? string The HF model to use. If not specified, will call huggingface.co/api/tasks to get the default model for the task. /!\ Legacy behavior allows this to be an URL, but this is deprecated and will be removed in the future. Use the endpointUrl parameter instead.
args.provider? "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" Set an Inference provider to run this model on. Defaults to the first provider in your user settings that is compatible with this model.
options? Options -
Returns

Promise\<TabularRegressionOutput>

Inherited from

InferenceClient.tabularRegression

Defined in

inference/src/tasks/tabular/tabularRegression.ts:24


textClassification

textClassification: (args: {}, options?: Options) => Promise\<TextClassificationOutput>

Type declaration

▸ (args, options?): Promise\<TextClassificationOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<TextClassificationOutput>

Inherited from

InferenceClient.textClassification

Defined in

inference/src/tasks/nlp/textClassification.ts:11


textGeneration

textGeneration: (args: {}, options?: Options) => Promise\<TextGenerationOutput>

Type declaration

▸ (args, options?): Promise\<TextGenerationOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<TextGenerationOutput>

Inherited from

InferenceClient.textGeneration

Defined in

inference/src/tasks/nlp/textGeneration.ts:34


textGenerationStream

textGenerationStream: (args: {}, options?: Options) => AsyncGenerator\<TextGenerationStreamOutput, any, unknown>

Type declaration

▸ (args, options?): AsyncGenerator\<TextGenerationStreamOutput, any, unknown>

Parameters
Name Type
args Object
options? Options
Returns

AsyncGenerator\<TextGenerationStreamOutput, any, unknown>

Inherited from

InferenceClient.textGenerationStream

Defined in

inference/src/tasks/nlp/textGenerationStream.ts:88


textToImage

textToImage: (args: {}, options?: TextToImageOptions & { outputType?: "blob" }) => Promise\<Blob>

Type declaration

▸ (args, options?): Promise\<Blob>

Parameters
Name Type
args Object
options? TextToImageOptions & { outputType?: "blob" }
Returns

Promise\<Blob>

Inherited from

InferenceClient.textToImage

Defined in

inference/src/tasks/cv/textToImage.ts:50

inference/src/tasks/cv/textToImage.ts:54

inference/src/tasks/cv/textToImage.ts:58


textToSpeech

textToSpeech: (args: {}, options?: Options) => Promise\<Blob>

Type declaration

▸ (args, options?): Promise\<Blob>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<Blob>

Inherited from

InferenceClient.textToSpeech

Defined in

inference/src/tasks/audio/textToSpeech.ts:15


textToVideo

textToVideo: (args: {}, options?: Options) => Promise\<Blob>

Type declaration

▸ (args, options?): Promise\<Blob>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<Blob>

Inherited from

InferenceClient.textToVideo

Defined in

inference/src/tasks/cv/textToVideo.ts:25


tokenClassification

tokenClassification: (args: {}, options?: Options) => Promise\<TokenClassificationOutput>

Type declaration

▸ (args, options?): Promise\<TokenClassificationOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<TokenClassificationOutput>

Inherited from

InferenceClient.tokenClassification

Defined in

inference/src/tasks/nlp/tokenClassification.ts:12


translation

translation: (args: {}, options?: Options) => Promise\<TranslationOutput>

Type declaration

▸ (args, options?): Promise\<TranslationOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<TranslationOutput>

Inherited from

InferenceClient.translation

Defined in

inference/src/tasks/nlp/translation.ts:10


visualQuestionAnswering

visualQuestionAnswering: (args: {}, options?: Options) => Promise\<VisualQuestionAnsweringOutputElement>

Type declaration

▸ (args, options?): Promise\<VisualQuestionAnsweringOutputElement>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<VisualQuestionAnsweringOutputElement>

Inherited from

InferenceClient.visualQuestionAnswering

Defined in

inference/src/tasks/multimodal/visualQuestionAnswering.ts:18


zeroShotClassification

zeroShotClassification: (args: {}, options?: Options) => Promise\<ZeroShotClassificationOutput>

Type declaration

▸ (args, options?): Promise\<ZeroShotClassificationOutput>

Parameters
Name Type
args Object
options? Options
Returns

Promise\<ZeroShotClassificationOutput>

Inherited from

InferenceClient.zeroShotClassification

Defined in

inference/src/tasks/nlp/zeroShotClassification.ts:12


zeroShotImageClassification

zeroShotImageClassification: (args: { endpointUrl?: string ; inputs: { image: Blob | ArrayBuffer } ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}, options?: Options) => Promise\<ZeroShotImageClassificationOutput>

Type declaration

▸ (args, options?): Promise\<ZeroShotImageClassificationOutput>

Parameters
Name Type
args { endpointUrl?: string ; inputs: { image: Blob | ArrayBuffer } ; model?: string ; provider?: "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" } | {}
options? Options
Returns

Promise\<ZeroShotImageClassificationOutput>

Inherited from

InferenceClient.zeroShotImageClassification

Defined in

inference/src/tasks/cv/zeroShotImageClassification.ts:44

Methods

endpoint

endpoint(endpointUrl): InferenceClientEndpoint

Returns copy of InferenceClient tied to a specified endpoint.

Parameters

Name Type
endpointUrl string

Returns

InferenceClientEndpoint

Inherited from

InferenceClient.endpoint

Defined in

inference/src/InferenceClient.ts:45

< > Update on GitHub