HubCloneHubClone
Tasks

Text Classification

Text classification assigns a label or class to a piece of text, such as its sentiment or topic.

Inputs

Input

I loved every minute of this film!

Text Classification Model

Output

Output
  • POSITIVE0.98
  • NEGATIVE0.02

About Text Classification

Text classification assigns a label or class to a piece of text, such as its sentiment or topic. Browse text classification models on HubClone to compare checkpoints, or open a Space to try one in the browser.

Use Cases

Sentiment analysis

Tell whether a product review is positive or negative.

Content moderation

Flag toxic or spam messages before they are published.

Inference

The Transformers pipeline API runs text classification models in a few lines. Replace <model-id> with any model listed on this page.

from transformers import pipeline

pipe = pipeline("text-classification", model="<model-id>")
pipe("I loved every minute of this film!")

Useful Resources

Want to dig deeper into the topic? Great! Here is a hand-picked list of resources we found helpful.

Documentation

  • Text Classification task guide
  • Pipelines reference

Notebooks

  • Fine-tuning a text classification model