# Lớp: InferenceClient

## Hệ thống phân cấp

- `Task`

  ↳ **`InferenceClient`**

  ↳↳ [`InferenceClientEndpoint`](InferenceClientEndpoint)

  ↳↳ [`HfInference`](HfInference)

## Hàm khởi tạo

### constructor

• **mới InferenceClient**(`accessToken?`, `defaultOptions?`): [`InferenceClient`](InferenceClient)

#### Tham số[[constructor.parameters]]

| Tên | Loại | Giá trị mặc định |
| :------ | :------ | :------ |
| `accessToken` | `string` | `""` |
| `defaultOptions` | [`Options`](../interfaces/Options) & \{ `endpointUrl?`: `string`  } | `{}` |

#### Trả về[[constructor.returns]]

[`InferenceClient`](InferenceClient)

#### Được định nghĩa trong[[constructor.defined-in]]

[inference/src/InferenceClient.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L15)

## Thuộc tính

### accessToken

• `Private` `Readonly` **accessToken**: `string`

#### Được định nghĩa trong[[accesstoken.defined-in]]

[inference/src/InferenceClient.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L12)

___

### defaultOptions

• `Private` `Readonly` **defaultOptions**: [`Options`](../interfaces/Options)

#### Được định nghĩa trong[[defaultoptions.defined-in]]

[inference/src/InferenceClient.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L13)

## Phương thức

### audioClassification

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

Nhiệm vụ này đọc một số đầu vào âm thanh và đưa ra xác suất của các lớp. Mô hình được khuyến nghị: superb/hubert-large-superb-er

#### Tham số[[audioclassification.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`AudioClassificationArgs`](../modules#audioclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[audioclassification.returns]]

`Promise`\<`AudioClassificationOutput`\>

#### Được định nghĩa trong[[audioclassification.defined-in]]

[inference/src/tasks/audio/audioClassification.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/audioClassification.ts#L15)

___

### audioToAudio

▸ **audioToAudio**(`args`, `options?`): `Promise`\<[`AudioToAudioOutput`](../interfaces/AudioToAudioOutput)[]\>

Nhiệm vụ này đọc một số đầu vào âm thanh và xuất ra một hoặc nhiều tệp âm thanh. Mô hình ví dụ: speechbrain/sepformer-wham thực hiện tách nguồn âm thanh.

#### Tham số[[audiotoaudio.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`AudioToAudioArgs`](../modules#audiotoaudioargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[audiotoaudio.returns]]

`Promise`\<[`AudioToAudioOutput`](../interfaces/AudioToAudioOutput)[]\>

#### Được định nghĩa trong[[audiotoaudio.defined-in]]

[inference/src/tasks/audio/audioToAudio.ts:41](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/audioToAudio.ts#L41)

___

### automaticSpeechRecognition

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

Nhiệm vụ này đọc một số đầu vào âm thanh và xuất ra các từ được nói trong các tệp âm thanh. Mô hình được khuyến nghị (tiếng Anh): facebook/wav2vec2-large-960h-lv60-self

#### Tham số[[automaticspeechrecognition.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`AutomaticSpeechRecognitionArgs`](../modules#automaticspeechrecognitionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[automaticspeechrecognition.returns]]

`Promise`\<`AutomaticSpeechRecognitionOutput`\>

#### Được định nghĩa trong[[automaticspeechrecognition.defined-in]]

[inference/src/tasks/audio/automaticSpeechRecognition.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/automaticSpeechRecognition.ts#L13)

___

### chatCompletion

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

Sử dụng điểm cuối hoàn thành trò chuyện để tạo phản hồi cho một lời nhắc, bằng cách sử dụng API hoàn thành tin nhắn OpenAI không có luồng

#### Tham số[[chatcompletion.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & `ChatCompletionInput` |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[chatcompletion.returns]]

`Promise`\<`ChatCompletionOutput`\>

#### Được định nghĩa trong[[chatcompletion.defined-in]]

[inference/src/tasks/nlp/chatCompletion.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/chatCompletion.ts#L12)

___

### chatCompletionStream

▸ **chatCompletionStream**(`args`, `options?`): `AsyncGenerator`\<`ChatCompletionStreamOutput`\>

Dùng để tiếp tục văn bản từ một prompt. Giống như `textGeneration` nhưng trả về generator có thể đọc từng token một

#### Tham số[[chatcompletionstream.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & `ChatCompletionInput` |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[chatcompletionstream.returns]]

`AsyncGenerator`\<`ChatCompletionStreamOutput`\>

#### Được định nghĩa trong[[chatcompletionstream.defined-in]]

[inference/src/tasks/nlp/chatCompletionStream.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/chatCompletionStream.ts#L12)

___

### documentQuestionAnswering

▸ **documentQuestionAnswering**(`args`, `options?`): `Promise`\<`DocumentQuestionAnsweringOutput`[`number`]\>

Trả lời câu hỏi trên ảnh tài liệu. Mô hình được khuyến nghị: impira/layoutlm-document-qa.

#### Tham số[[documentquestionanswering.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`DocumentQuestionAnsweringArgs`](../modules#documentquestionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[documentquestionanswering.returns]]

`Promise`\<`DocumentQuestionAnsweringOutput`[`number`]\>

#### Được định nghĩa trong[[documentquestionanswering.defined-in]]

[inference/src/tasks/multimodal/documentQuestionAnswering.ts:19](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/multimodal/documentQuestionAnswering.ts#L19)

___

### endpoint

▸ **endpoint**(`endpointUrl`): [`InferenceClient`](InferenceClient)

Trả về một instance mới của InferenceClient được liên kết với một endpoint được chỉ định.

Chủ yếu là để đảm bảo tính tương thích ngược.

#### Tham số[[endpoint.parameters]]

| Tên | Loại |
| :------ | :------ |
| `endpointUrl` | `string` |

#### Trả về[[endpoint.returns]]

[`InferenceClient`](InferenceClient)

#### Được định nghĩa trong[[endpoint.defined-in]]

[inference/src/InferenceClient.ts:46](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/InferenceClient.ts#L46)

___

### featureExtraction

▸ **featureExtraction**(`args`, `options?`): `Promise`\<[`FeatureExtractionOutput`](../modules#featureextractionoutput)\>

Nhiệm vụ này đọc một số văn bản và xuất ra các giá trị float thô, thường được sử dụng như một phần của cơ sở dữ liệu ngữ nghĩa/tìm kiếm ngữ nghĩa.

#### Tham số[[featureextraction.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`FeatureExtractionArgs`](../modules#featureextractionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[featureextraction.returns]]

`Promise`\<[`FeatureExtractionOutput`](../modules#featureextractionoutput)\>

#### Được định nghĩa trong[[featureextraction.defined-in]]

[inference/src/tasks/nlp/featureExtraction.ts:22](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/featureExtraction.ts#L22)

___

### fillMask

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

Thử điền vào một khoảng trống bằng một từ bị thiếu (chính xác hơn là một token). Đây là tác vụ cơ bản cho các mô hình BERT.

#### Tham số[[fillmask.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`FillMaskArgs`](../modules#fillmaskargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[fillmask.returns]]

`Promise`\<`FillMaskOutput`\>

#### Được định nghĩa trong[[fillmask.defined-in]]

[inference/src/tasks/nlp/fillMask.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/fillMask.ts#L12)

___

### imageClassification

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

Nhiệm vụ này đọc một số đầu vào hình ảnh và đưa ra xác suất của các lớp. Mô hình được khuyến nghị: google/vit-base-patch16-224

#### Tham số[[imageclassification.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ImageClassificationArgs`](../modules#imageclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[imageclassification.returns]]

`Promise`\<`ImageClassificationOutput`\>

#### Được định nghĩa trong[[imageclassification.defined-in]]

[inference/src/tasks/cv/imageClassification.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageClassification.ts#L14)

___

### imageSegmentation

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

Nhiệm vụ này đọc một số đầu vào hình ảnh và đưa ra xác suất của các lớp & các hộp bao quanh các đối tượng được phát hiện. Mô hình được khuyến nghị: facebook/detr-resnet-50-panoptic

#### Tham số[[imagesegmentation.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ImageSegmentationArgs`](../modules#imagesegmentationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[imagesegmentation.returns]]

`Promise`\<`ImageSegmentationOutput`\>

#### Được định nghĩa trong[[imagesegmentation.defined-in]]

[inference/src/tasks/cv/imageSegmentation.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageSegmentation.ts#L14)

___

### imageTextToImage

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

Nhiệm vụ này nhận đầu vào là hình ảnh và văn bản, sau đó tạo ra một hình ảnh mới. Mô hình được khuyến nghị: black-forest-labs/FLUX.2-dev

#### Tham số[[imagetexttoimage.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ImageTextToImageArgs`](../modules#imagetexttoimageargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[imagetexttoimage.returns]]

`Promise`\<`Blob`\>

#### Được định nghĩa trong[[imagetexttoimage.defined-in]]

[inference/src/tasks/cv/imageTextToImage.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageTextToImage.ts#L13)

___

### imageTextToVideo

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

Nhiệm vụ này nhận đầu vào là hình ảnh và văn bản, sau đó tạo ra một video. Mô hình được khuyến nghị: Lightricks/LTX-Video

#### Tham số[[imagetexttovideo.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ImageTextToVideoArgs`](../modules#imagetexttovideoargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[imagetexttovideo.returns]]

`Promise`\<`Blob`\>

#### Được định nghĩa trong[[imagetexttovideo.defined-in]]

[inference/src/tasks/cv/imageTextToVideo.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageTextToVideo.ts#L13)

___

### imageToImage

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

Nhiệm vụ này đọc một số đầu vào văn bản và xuất ra một hình ảnh. Mô hình được khuyến nghị: lllyasviel/sd-controlnet-depth

#### Tham số[[imagetoimage.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ImageToImageArgs`](../modules#imagetoimageargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[imagetoimage.returns]]

`Promise`\<`Blob`\>

#### Được định nghĩa trong[[imagetoimage.defined-in]]

[inference/src/tasks/cv/imageToImage.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageToImage.ts#L14)

___

### imageToText

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

Nhiệm vụ này đọc một số đầu vào hình ảnh và xuất ra chú thích văn bản.

#### Tham số[[imagetotext.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ImageToTextArgs`](../modules#imagetotextargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[imagetotext.returns]]

`Promise`\<`ImageToTextOutput`\>

#### Được định nghĩa trong[[imagetotext.defined-in]]

[inference/src/tasks/cv/imageToText.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageToText.ts#L12)

___

### imageToVideo

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

Nhiệm vụ này đọc một số đầu vào văn bản và xuất ra một hình ảnh. Mô hình được khuyến nghị: Wan-AI/Wan2.1-I2V-14B-720P

#### Tham số[[imagetovideo.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ImageToVideoArgs`](../modules#imagetovideoargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[imagetovideo.returns]]

`Promise`\<`Blob`\>

#### Được định nghĩa trong[[imagetovideo.defined-in]]

[inference/src/tasks/cv/imageToVideo.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/imageToVideo.ts#L14)

___

### objectDetection

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

Nhiệm vụ này đọc một số đầu vào hình ảnh và đưa ra xác suất của các lớp & các hộp bao quanh các đối tượng được phát hiện. Mô hình được khuyến nghị: facebook/detr-resnet-50

#### Tham số[[objectdetection.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ObjectDetectionArgs`](../modules#objectdetectionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[objectdetection.returns]]

`Promise`\<`ObjectDetectionOutput`\>

#### Được định nghĩa trong[[objectdetection.defined-in]]

[inference/src/tasks/cv/objectDetection.ts:14](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/objectDetection.ts#L14)

___

### questionAnswering

▸ **questionAnswering**(`args`, `options?`): `Promise`\<`QuestionAnsweringOutput`[`number`]\>

Bạn muốn có một bot thông thái có thể trả lời mọi câu hỏi? Mô hình được đề xuất: deepset/roberta-base-squad2

#### Tham số[[questionanswering.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`QuestionAnsweringArgs`](../modules#questionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[questionanswering.returns]]

`Promise`\<`QuestionAnsweringOutput`[`number`]\>

#### Được định nghĩa trong[[questionanswering.defined-in]]

[inference/src/tasks/nlp/questionAnswering.ts:13](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/questionAnswering.ts#L13)

___

### request

▸ **request**\<`T`\>(`args`, `options?`): `Promise`\<`T`\>

Primitive để thực hiện các cuộc gọi tùy chỉnh đến nhà cung cấp suy luận

#### Tham số kiểu[[request.type-parameters]]

| Tên |
| :------ |
| `T` |

#### Tham số[[request.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`RequestArgs`](../modules#requestargs) |
| `options?` | [`Options`](../interfaces/Options) & \{ `task?`: [`InferenceTask`](../modules#inferencetask)  } |

#### Trả về[[request.returns]]

`Promise`\<`T`\>

**`Deprecated`**

Hãy sử dụng các hàm tác vụ cụ thể thay thế. Hàm này sẽ bị loại bỏ trong một phiên bản tương lai.

#### Được định nghĩa trong[[request.defined-in]]

[inference/src/tasks/custom/request.ts:11](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/custom/request.ts#L11)

___

### sentenceSimilarity

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

Tính độ tương đồng ngữ nghĩa giữa một văn bản và danh sách các câu khác bằng cách so sánh các vector nhúng của chúng.

#### Tham số[[sentencesimilarity.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`SentenceSimilarityArgs`](../modules#sentencesimilarityargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[sentencesimilarity.returns]]

`Promise`\<`SentenceSimilarityOutput`\>

#### Được định nghĩa trong[[sentencesimilarity.defined-in]]

[inference/src/tasks/nlp/sentenceSimilarity.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/sentenceSimilarity.ts#L12)

___

### streamingRequest

▸ **streamingRequest**\<`T`\>(`args`, `options?`): `AsyncGenerator`\<`T`\>

Primitive để thực hiện các cuộc gọi suy luận tùy chỉnh, kỳ vọng các sự kiện do máy chủ gửi (server-sent events), và trả về phản hồi thông qua một generator

#### Tham số kiểu[[streamingrequest.type-parameters]]

| Tên |
| :------ |
| `T` |

#### Tham số[[streamingrequest.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`RequestArgs`](../modules#requestargs) |
| `options?` | [`Options`](../interfaces/Options) & \{ `task?`: [`InferenceTask`](../modules#inferencetask)  } |

#### Trả về[[streamingrequest.returns]]

`AsyncGenerator`\<`T`\>

**`Deprecated`**

Hãy sử dụng các hàm tác vụ cụ thể thay thế. Hàm này sẽ bị loại bỏ trong một phiên bản tương lai.

#### Được định nghĩa trong[[streamingrequest.defined-in]]

[inference/src/tasks/custom/streamingRequest.ts:11](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/custom/streamingRequest.ts#L11)

___

### tóm tắt

▸ **tóm tắt**(`args`, `options?`): `Promise`\<`SummarizationOutput`\>

Nhiệm vụ này được biết đến rộng rãi với việc tóm tắt văn bản dài thành văn bản ngắn hơn. Hãy cẩn thận, một số mô hình có giới hạn độ dài tối đa của đầu vào. Điều đó có nghĩa là bản tóm tắt không thể xử lý các cuốn sách hoàn chỉnh, chẳng hạn. Hãy cẩn thận khi chọn mô hình của bạn.

#### Tham số[[summarization.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`SummarizationArgs`](../modules#summarizationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[summarization.returns]]

`Promise`\<`SummarizationOutput`\>

#### Được định nghĩa trong[[summarization.defined-in]]

[inference/src/tasks/nlp/summarization.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/summarization.ts#L12)

___

### tableQuestionAnswering

▸ **tableQuestionAnswering**(`args`, `options?`): `Promise`\<`TableQuestionAnsweringOutput`[`number`]\>

Không biết SQL? Không muốn đào sâu vào một bảng tính lớn? Hãy đặt câu hỏi bằng tiếng Anh thông thường! Mô hình được đề xuất: google/tapas-base-finetuned-wtq.

#### Tham số[[tablequestionanswering.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TableQuestionAnsweringArgs`](../modules#tablequestionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[tablequestionanswering.returns]]

`Promise`\<`TableQuestionAnsweringOutput`[`number`]\>

#### Được định nghĩa trong[[tablequestionanswering.defined-in]]

[inference/src/tasks/nlp/tableQuestionAnswering.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/tableQuestionAnswering.ts#L12)

___

### tabularClassification

▸ **tabularClassification**(`args`, `options?`): `Promise`\<[`TabularClassificationOutput`](../modules#tabularclassificationoutput)\>

Dự đoán nhãn đích cho một tập hợp các đặc trưng ở dạng bảng. Thông thường, bạn sẽ muốn huấn luyện một mô hình phân loại trên dữ liệu huấn luyện của mình và sử dụng nó với dữ liệu mới có cùng định dạng. Ví dụ về mô hình: vvmnnnkv/wine-quality

#### Tham số[[tabularclassification.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TabularClassificationArgs`](../modules#tabularclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[tabularclassification.returns]]

`Promise`\<[`TabularClassificationOutput`](../modules#tabularclassificationoutput)\>

#### Được định nghĩa trong[[tabularclassification.defined-in]]

[inference/src/tasks/tabular/tabularClassification.ts:25](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/tabular/tabularClassification.ts#L25)

___

### tabularRegression

▸ **tabularRegression**(`args`, `options?`): `Promise`\<[`TabularRegressionOutput`](../modules#tabularregressionoutput)\>

Dự đoán giá trị mục tiêu cho một tập các đặc trưng ở dạng bảng. Thông thường, bạn sẽ muốn huấn luyện một mô hình hồi quy trên dữ liệu huấn luyện của mình và sử dụng nó với dữ liệu mới có cùng định dạng. Ví dụ về mô hình: scikit-learn/Fish-Weight

#### Tham số[[tabularregression.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TabularRegressionArgs`](../modules#tabularregressionargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[tabularregression.returns]]

`Promise`\<[`TabularRegressionOutput`](../modules#tabularregressionoutput)\>

#### Được định nghĩa trong[[tabularregression.defined-in]]

[inference/src/tasks/tabular/tabularRegression.ts:25](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/tabular/tabularRegression.ts#L25)

___

### textClassification

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

Thường được sử dụng cho phân tích cảm xúc, điều này sẽ đưa ra xác suất của các lớp đối với một đầu vào. Mô hình được khuyến nghị: distilbert-base-uncased-finetuned-sst-2-english

#### Tham số[[textclassification.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextClassificationArgs`](../modules#textclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[textclassification.returns]]

`Promise`\<`TextClassificationOutput`\>

#### Được định nghĩa trong[[textclassification.defined-in]]

[inference/src/tasks/nlp/textClassification.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textClassification.ts#L12)

___

### textGeneration

▸ **textGeneration**(`args`, `options?`): `Promise`\<[`TextGenerationOutput`](../interfaces/TextGenerationOutput)\>

Sử dụng để tiếp tục văn bản từ một prompt. Đây là một tác vụ rất chung chung. Mô hình được khuyến nghị: gpt2 (đây là một mô hình đơn giản, nhưng thú vị để thử nghiệm).

#### Tham số[[textgeneration.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & [`TextGenerationInput`](../interfaces/TextGenerationInput) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[textgeneration.returns]]

`Promise`\<[`TextGenerationOutput`](../interfaces/TextGenerationOutput)\>

#### Được định nghĩa trong[[textgeneration.defined-in]]

[inference/src/tasks/nlp/textGeneration.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textGeneration.ts#L12)

___

### textGenerationStream

▸ **textGenerationStream**(`args`, `options?`): `AsyncGenerator`\<[`TextGenerationStreamOutput`](../interfaces/TextGenerationStreamOutput)\>

Dùng để tiếp tục văn bản từ một prompt. Giống như `textGeneration` nhưng trả về generator có thể đọc từng token một

#### Tham số[[textgenerationstream.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`BaseArgs`](../interfaces/BaseArgs) & [`TextGenerationInput`](../interfaces/TextGenerationInput) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[textgenerationstream.returns]]

`AsyncGenerator`\<[`TextGenerationStreamOutput`](../interfaces/TextGenerationStreamOutput)\>

#### Được định nghĩa trong[[textgenerationstream.defined-in]]

[inference/src/tasks/nlp/textGenerationStream.ts:90](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textGenerationStream.ts#L90)

___

### textRanking

▸ **textRanking**(`args`, `options?`): `Promise`\<`TextRankingOutput`\>

Xếp hạng các tài liệu theo mức độ liên quan đến truy vấn bằng cách sử dụng mô hình reranker.

#### Tham số[[textranking.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextRankingArgs`](../modules#textrankingargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[textranking.returns]]

`Promise`\<`TextRankingOutput`\>

#### Được định nghĩa trong[[textranking.defined-in]]

[inference/src/tasks/nlp/textRanking.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/textRanking.ts#L12)

___

### textToAudio

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

Nhiệm vụ này tạo ra âm thanh (ví dụ: nhạc hoặc hiệu ứng âm thanh) từ một câu lệnh văn bản đầu vào. Mô hình ví dụ: stabilityai/stable-audio-open-1.0

#### Tham số[[texttoaudio.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextToAudioArgs`](../modules#texttoaudioargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[texttoaudio.returns]]

`Promise`\<`Blob`\>

#### Được định nghĩa trong[[texttoaudio.defined-in]]

[inference/src/tasks/audio/textToAudio.ts:18](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/textToAudio.ts#L18)

___

### textToImage

▸ **textToImage**(`args`, `options?`): `Promise`\<`string`\>

Nhiệm vụ này đọc một số đầu vào văn bản và xuất ra một hình ảnh. Mô hình được khuyến nghị: stabilityai/stable-diffusion-2

#### Tham số[[texttoimage.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType`: ``"url"``  } |

#### Trả về[[texttoimage.returns]]

`Promise`\<`string`\>

#### Được định nghĩa trong[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:18](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L18)

▸ **textToImage**(`args`, `options?`): `Promise`\<`string`\>

#### Tham số[[texttoimage.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType`: ``"dataUrl"``  } |

#### Trả về[[texttoimage.returns]]

`Promise`\<`string`\>

#### Được định nghĩa trong[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:22](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L22)

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

#### Tham số[[texttoimage.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType?`: ``"blob"``  } |

#### Trả về[[texttoimage.returns]]

`Promise`\<`Blob`\>

#### Được định nghĩa trong[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:26](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L26)

▸ **textToImage**(`args`, `options?`): `Promise`\<`Record`\<`string`, `unknown`\>\>

#### Tham số[[texttoimage.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextToImageArgs`](../modules#texttoimageargs) |
| `options?` | `TextToImageOptions` & \{ `outputType?`: ``"json"``  } |

#### Trả về[[texttoimage.returns]]

`Promise`\<`Record`\<`string`, `unknown`\>\>

#### Được định nghĩa trong[[texttoimage.defined-in]]

[inference/src/tasks/cv/textToImage.ts:30](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToImage.ts#L30)

___

### textToSpeech

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

Nhiệm vụ này tổng hợp âm thanh của giọng đọc phát âm một văn bản cho trước. Mô hình được khuyến nghị: espnet/kan-bayashi_ljspeech_vits

#### Tham số[[texttospeech.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | `TextToSpeechArgs` |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[texttospeech.returns]]

`Promise`\<`Blob`\>

#### Được định nghĩa trong[[texttospeech.defined-in]]

[inference/src/tasks/audio/textToSpeech.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/audio/textToSpeech.ts#L15)

___

### textToVideo

▸ **textToVideo**(`args`, `options?`): `Promise`\<[`TextToVideoOutput`](../modules#texttovideooutput)\>

#### Tham số[[texttovideo.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TextToVideoArgs`](../modules#texttovideoargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[texttovideo.returns]]

`Promise`\<[`TextToVideoOutput`](../modules#texttovideooutput)\>

#### Được định nghĩa trong[[texttovideo.defined-in]]

[inference/src/tasks/cv/textToVideo.ts:15](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/textToVideo.ts#L15)

___

### tokenClassification

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

Thường được sử dụng để phân tích câu, có thể là phân tích ngữ pháp hoặc Nhận diện thực thể có tên (NER) để hiểu các từ khóa chứa trong văn bản. Mô hình được khuyến nghị: dbmdz/bert-large-cased-finetuned-conll03-english

#### Tham số[[tokenclassification.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TokenClassificationArgs`](../modules#tokenclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[tokenclassification.returns]]

`Promise`\<`TokenClassificationOutput`\>

#### Được định nghĩa trong[[tokenclassification.defined-in]]

[inference/src/tasks/nlp/tokenClassification.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/tokenClassification.ts#L12)

___

### dịch

▸ **dịch**(`args`, `options?`): `Promise`\<`TranslationOutput`\>

Nhiệm vụ này được biết đến rộng rãi với việc dịch văn bản từ ngôn ngữ này sang ngôn ngữ khác. Mô hình được khuyến nghị: Helsinki-NLP/opus-mt-ru-en.

#### Tham số[[translation.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`TranslationArgs`](../modules#translationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[translation.returns]]

`Promise`\<`TranslationOutput`\>

#### Được định nghĩa trong[[translation.defined-in]]

[inference/src/tasks/nlp/translation.ts:11](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/translation.ts#L11)

___

### visualQuestionAnswering

▸ **visualQuestionAnswering**(`args`, `options?`): `Promise`\<`VisualQuestionAnsweringOutput`[`number`]\>

Trả lời câu hỏi về một hình ảnh. Mô hình được khuyến nghị: dandelin/vilt-b32-finetuned-vqa.

#### Tham số[[visualquestionanswering.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`VisualQuestionAnsweringArgs`](../modules#visualquestionansweringargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[visualquestionanswering.returns]]

`Promise`\<`VisualQuestionAnsweringOutput`[`number`]\>

#### Được định nghĩa trong[[visualquestionanswering.defined-in]]

[inference/src/tasks/multimodal/visualQuestionAnswering.ts:19](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/multimodal/visualQuestionAnswering.ts#L19)

___

### zeroShotClassification

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

Nhiệm vụ này cực kỳ hữu ích để thử nghiệm phân loại với zero code, bạn chỉ cần truyền một câu/đoạn văn và các nhãn có thể có cho câu đó, và bạn sẽ nhận được kết quả. Mô hình được khuyến nghị: facebook/bart-large-mnli.

#### Tham số[[zeroshotclassification.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ZeroShotClassificationArgs`](../modules#zeroshotclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[zeroshotclassification.returns]]

`Promise`\<`ZeroShotClassificationOutput`\>

#### Được định nghĩa trong[[zeroshotclassification.defined-in]]

[inference/src/tasks/nlp/zeroShotClassification.ts:12](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/nlp/zeroShotClassification.ts#L12)

___

### zeroShotImageClassification

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

Phân loại một hình ảnh vào các lớp được chỉ định. Mô hình được khuyến nghị: openai/clip-vit-large-patch14-336

#### Tham số[[zeroshotimageclassification.parameters]]

| Tên | Loại |
| :------ | :------ |
| `args` | [`ZeroShotImageClassificationArgs`](../modules#zeroshotimageclassificationargs) |
| `options?` | [`Options`](../interfaces/Options) |

#### Trả về[[zeroshotimageclassification.returns]]

`Promise`\<`ZeroShotImageClassificationOutput`\>

#### Được định nghĩa trong[[zeroshotimageclassification.defined-in]]

[inference/src/tasks/cv/zeroShotImageClassification.ts:44](https://github.com/huggingface/huggingface.js/blob/main/packages/inference/src/tasks/cv/zeroShotImageClassification.ts#L44)

