hf_ez_text_classification: Classify Texts into Pre-trained Categories

View source: R/ez.R

hf_ez_text_classificationR Documentation

Classify Texts into Pre-trained Categories

Description

Usually used for sentiment-analysis this will output the likelihood of classes of an input.

Usage

hf_ez_text_classification(
  model_id = "distilbert-base-uncased-finetuned-sst-2-english",
  use_api = FALSE
)

Arguments

model_id

A model_id. Run hf_search_models(...) for model_ids. Defaults to 'distilbert-base-uncased-finetuned-sst-2-english'.

use_api

Whether to use the Inference API to run the model (TRUE) or download and run the model locally (FALSE). Defaults to FALSE

Value

A text classification object

See Also

https://huggingface.co/docs/api-inference/detailed_parameters#text-classification-task

Examples

## Not run: 
# Load the default model and use local inference
ez <- hf_ez_text_classification()
ez$infer(string = c('I like you. I love you'), flatten = FALSE)

# Use the api for inference.
ez <- hf_ez_text_classification(use_api = TRUE)
ez$infer(string = c('I like you. I love you'), flatten = FALSE)

## End(Not run)

farach/huggingfaceR documentation built on Feb. 4, 2023, 10:31 p.m.