• new HfInference(apiKey?
, defaultOptions?
)
Name | Type | Default value |
---|---|---|
apiKey |
string |
"" |
defaultOptions |
Options |
{} |
• Private
Readonly
apiKey: string
• Private
Readonly
defaultOptions: Options
▸ audioClassification(args
, options?
): Promise
<AudioClassificationReturn
>
This task reads some audio input and outputs the likelihood of classes. Recommended model: superb/hubert-large-superb-er
Name | Type |
---|---|
args |
AudioClassificationArgs |
options? |
Options |
Promise
<AudioClassificationReturn
>
▸ automaticSpeechRecognition(args
, options?
): Promise
<AutomaticSpeechRecognitionReturn
>
This task reads some audio input and outputs the said words within the audio files. Recommended model (english language): facebook/wav2vec2-large-960h-lv60-self
Name | Type |
---|---|
args |
AutomaticSpeechRecognitionArgs |
options? |
Options |
Promise
<AutomaticSpeechRecognitionReturn
>
▸ conversational(args
, options?
): Promise
<ConversationalReturn
>
This task corresponds to any chatbot like structure. Models tend to have shorter max_length, so please check with caution when using a given model if you need long range dependency or not. Recommended model: microsoft/DialoGPT-large.
Name | Type |
---|---|
args |
ConversationalArgs |
options? |
Options |
Promise
<ConversationalReturn
>
▸ featureExtraction(args
, options?
): Promise
<FeatureExtractionReturn
>
This task reads some text and outputs raw float values, that are usually consumed as part of a semantic database/semantic search.
Name | Type |
---|---|
args |
FeatureExtractionArgs |
options? |
Options |
Promise
<FeatureExtractionReturn
>
▸ fillMask(args
, options?
): Promise
<FillMaskReturn
>
Tries to fill in a hole with a missing word (token to be precise). That’s the base task for BERT models.
Name | Type |
---|---|
args |
FillMaskArgs |
options? |
Options |
Promise
<FillMaskReturn
>
▸ imageClassification(args
, options?
): Promise
<ImageClassificationReturn
>
This task reads some image input and outputs the likelihood of classes. Recommended model: google/vit-base-patch16-224
Name | Type |
---|---|
args |
ImageClassificationArgs |
options? |
Options |
Promise
<ImageClassificationReturn
>
▸ imageSegmentation(args
, options?
): Promise
<ImageSegmentationReturn
>
This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects. Recommended model: facebook/detr-resnet-50-panoptic
Name | Type |
---|---|
args |
ImageSegmentationArgs |
options? |
Options |
Promise
<ImageSegmentationReturn
>
▸ objectDetection(args
, options?
): Promise
<ObjectDetectionReturn
>
This task reads some image input and outputs the likelihood of classes & bounding boxes of detected objects. Recommended model: facebook/detr-resnet-50
Name | Type |
---|---|
args |
ObjectDetectionArgs |
options? |
Options |
Promise
<ObjectDetectionReturn
>
▸ questionAnswer(args
, options?
): Promise
<QuestionAnswerReturn
>
Want to have a nice know-it-all bot that can answer any question?. Recommended model: deepset/roberta-base-squad2
Name | Type |
---|---|
args |
QuestionAnswerArgs |
options? |
Options |
Promise
<QuestionAnswerReturn
>
▸ request(args
, options?
): Promise
<any
>
Name | Type |
---|---|
args |
Args & { data? : any } |
options? |
Options & { binary? : boolean ; blob? : boolean } |
Promise
<any
>
▸ summarization(args
, options?
): Promise
<SummarizationReturn
>
This task is well known to summarize longer text into shorter text. Be careful, some models have a maximum length of input. That means that the summary cannot handle full books for instance. Be careful when choosing your model.
Name | Type |
---|---|
args |
SummarizationArgs |
options? |
Options |
Promise
<SummarizationReturn
>
▸ tableQuestionAnswer(args
, options?
): Promise
<TableQuestionAnswerReturn
>
Don’t know SQL? Don’t want to dive into a large spreadsheet? Ask questions in plain english! Recommended model: google/tapas-base-finetuned-wtq.
Name | Type |
---|---|
args |
TableQuestionAnswerArgs |
options? |
Options |
Promise
<TableQuestionAnswerReturn
>
▸ textClassification(args
, options?
): Promise
<TextClassificationReturn
>
Usually used for sentiment-analysis this will output the likelihood of classes of an input. Recommended model: distilbert-base-uncased-finetuned-sst-2-english
Name | Type |
---|---|
args |
TextClassificationArgs |
options? |
Options |
Promise
<TextClassificationReturn
>
▸ textGeneration(args
, options?
): Promise
<TextGenerationReturn
>
Use to continue text from a prompt. This is a very generic task. Recommended model: gpt2 (it’s a simple model, but fun to play with).
Name | Type |
---|---|
args |
TextGenerationArgs |
options? |
Options |
Promise
<TextGenerationReturn
>
▸ textToImage(args
, options?
): Promise
<ArrayBuffer
>
This task reads some text input and outputs an image. Recommended model: stabilityai/stable-diffusion-2
Name | Type |
---|---|
args |
TextToImageArgs |
options? |
Options |
Promise
<ArrayBuffer
>
▸ tokenClassification(args
, options?
): Promise
<TokenClassificationReturn
>
Usually used for sentence parsing, either grammatical, or Named Entity Recognition (NER) to understand keywords contained within text. Recommended model: dbmdz/bert-large-cased-finetuned-conll03-english
Name | Type |
---|---|
args |
TokenClassificationArgs |
options? |
Options |
Promise
<TokenClassificationReturn
>
▸ translation(args
, options?
): Promise
<TranslationReturn
>
This task is well known to translate text from one language to another. Recommended model: Helsinki-NLP/opus-mt-ru-en.
Name | Type |
---|---|
args |
TranslationArgs |
options? |
Options |
Promise
<TranslationReturn
>
▸ zeroShotClassification(args
, options?
): Promise
<ZeroShotClassificationReturn
>
This task is super useful to try out classification with zero code, you simply pass a sentence/paragraph and the possible labels for that sentence, and you get a result. Recommended model: facebook/bart-large-mnli.
Name | Type |
---|---|
args |
ZeroShotClassificationArgs |
options? |
Options |
Promise
<ZeroShotClassificationReturn
>
▸ Static
Private
toArray(obj
): any
[]
Name | Type |
---|---|
obj |
any |
any
[]