Huggingface.js 文档

类: HfInference

Hugging Face's logo
加入 Hugging Face 社区

并获得增强的文档体验

开始使用

类: HfInference

仅用于向后兼容。

继承关系

构造函数

constructor

new HfInference(accessToken?, defaultOptions?): HfInference

参数

名称 类型 默认值
accessToken string ""
defaultOptions Options {}

返回值

HfInference

继承自

InferenceClient.constructor

定义于

inference/src/InferenceClient.ts:28

属性

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.audioClassification

定义于

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[]>

类型声明

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

参数
名称 类型
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[]>

继承自

InferenceClient.audioToAudio

定义于

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.automaticSpeechRecognition

定义于

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


chatCompletion

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<ChatCompletionOutput>

继承自

InferenceClient.chatCompletion

定义于

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


chatCompletionStream

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

AsyncGenerator\<ChatCompletionStreamOutput, any, unknown>

继承自

InferenceClient.chatCompletionStream

定义于

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


documentQuestionAnswering

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<DocumentQuestionAnsweringOutputElement>

继承自

InferenceClient.documentQuestionAnswering

定义于

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


featureExtraction

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<FeatureExtractionOutput>

继承自

InferenceClient.featureExtraction

定义在

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


fillMask

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<FillMaskOutput>

继承自

InferenceClient.fillMask

定义在

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.imageClassification

定义在

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.imageSegmentation

定义在

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


imageToImage

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<Blob>

继承自

InferenceClient.imageToImage

定义在

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.imageToText

定义在

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.objectDetection

定义于

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


问题解答

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<QuestionAnsweringOutputElement>

继承自

InferenceClient.questionAnswering

定义于

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


请求

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.request

定义于

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


句子相似度

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<SentenceSimilarityOutput>

继承自

InferenceClient.sentenceSimilarity

定义于

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


流式请求

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.streamingRequest

定义于

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


文本摘要

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<SummarizationOutput>

继承自

InferenceClient.summarization

定义于

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


表格问答

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回值

Promise\<TableQuestionAnsweringOutputElement>

继承自

InferenceClient.tableQuestionAnswering

定义于

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


表格分类

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>

类型声明

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

参数
名称 类型 描述
args Object -
args.endpointUrl? string 要使用的端点 URL。如果未指定,将调用 huggingface.co/api/tasks 以获取任务的默认端点。如果指定,将使用此 URL 而不是默认 URL。
args.inputs Object -
args.inputs.data Record\<string, string[]> 数据表格,表示为列表字典,其中条目是标题,列表是所有值,所有列表的大小必须相同。
args.model? string 要使用的 HF 模型。如果未指定,将调用 huggingface.co/api/tasks 以获取任务的默认模型。/!\\ 遗留行为允许这是一个 URL,但这已被弃用,并且将来会被删除。请改用 endpointUrl 参数。
args.provider? "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" 设置一个推理提供商来运行此模型。默认为您的用户设置中与此模型兼容的第一个提供商。
options? Options -
返回值

Promise\<TabularClassificationOutput>

继承自

InferenceClient.tabularClassification

定义于

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


表格回归

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>

类型声明

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

参数
名称 类型 描述
args Object -
args.endpointUrl? string 要使用的端点 URL。如果未指定,将调用 huggingface.co/api/tasks 以获取任务的默认端点。如果指定,将使用此 URL 而不是默认 URL。
args.inputs Object -
args.inputs.data Record\<string, string[]> 数据表格,表示为列表字典,其中条目是标题,列表是所有值,所有列表的大小必须相同。
args.model? string 要使用的 HF 模型。如果未指定,将调用 huggingface.co/api/tasks 以获取任务的默认模型。/!\\ 遗留行为允许这是一个 URL,但这已被弃用,并且将来会被删除。请改用 endpointUrl 参数。
args.provider? "black-forest-labs" | "cerebras" | "cohere" | "fal-ai" | "fireworks-ai" | "hf-inference" | "hyperbolic" | "nebius" | "novita" | "openai" | "replicate" | "sambanova" | "together" 设置一个推理提供商来运行此模型。默认为您的用户设置中与此模型兼容的第一个提供商。
options? Options -
返回值

Promise\<TabularRegressionOutput>

继承自

InferenceClient.tabularRegression

定义于

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


文本分类

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<TextClassificationOutput>

继承自

InferenceClient.textClassification

定义于

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


文本生成

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<TextGenerationOutput>

继承自

InferenceClient.textGeneration

定义于

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


文本生成流

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

AsyncGenerator\<TextGenerationStreamOutput, any, unknown>

继承自

InferenceClient.textGenerationStream

定义于

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


文本到图像

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

类型声明

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

参数
名称 类型
args Object
options? TextToImageOptions & { outputType?: "blob" }
返回

Promise\<Blob>

继承自

InferenceClient.textToImage

定义于

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

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

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


文本到语音

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<Blob>

继承自

InferenceClient.textToSpeech

定义于

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


文本到视频

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<Blob>

继承自

InferenceClient.textToVideo

定义于

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


分词分类

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<TokenClassificationOutput>

继承自

InferenceClient.tokenClassification

定义于

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


翻译

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<TranslationOutput>

继承自

InferenceClient.translation

定义于

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


视觉问答

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<VisualQuestionAnsweringOutputElement>

继承自

InferenceClient.visualQuestionAnswering

定义于

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


零样本分类

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

类型声明

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

参数
名称 类型
args Object
options? Options
返回

Promise\<ZeroShotClassificationOutput>

继承自

InferenceClient.zeroShotClassification

定义于

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


零样本图像分类

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>

类型声明

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

参数
名称 类型
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>

继承自

InferenceClient.zeroShotImageClassification

定义于

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

方法

端点

endpoint(endpointUrl): InferenceClientEndpoint

返回绑定到指定端点的 InferenceClient 的副本。

参数

名称 类型
endpointUrl string

返回值

InferenceClientEndpoint

继承自

InferenceClient.endpoint

定义于

inference/src/InferenceClient.ts:45

< > 在 GitHub 上更新