Milan97's picture
Update README.md
4ea7558 verified
metadata
tags:
  - autotrain
  - text-classification
base_model: sentence-transformers/all-mpnet-base-v2
widget:
  - text: I love AutoTrain
language:
  - en
pipeline_tag: text-classification

Clickbait Detection Model

This is a custom-trained text classification model created using Hugging Face AutoTrain. The model is designed to classify text into two categories:

  • Clickbait
  • Not Clickbait

The training was conducted using a fine-tuned version of the sentence-transformers/all-mpnet-base-v2 base model, which is well-suited for text classification tasks.


Model Details


Usage

You can use this model with Hugging Face’s transformers library to classify text into clickbait or not clickbait.

Example Code

from transformers import AutoTokenizer, AutoModelForSequenceClassification

# Load tokenizer and model
model_name = "Milan97/ClickbaitDetectionModel"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

# Input text
text = "You won’t believe what happened next!"

# Tokenize and perform inference
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
outputs = model(**inputs)

# Get predicted label and confidence
logits = outputs.logits
predicted_class = logits.argmax(dim=1).item()
confidence = logits.softmax(dim=1).max().item()

# Label mapping
labels = {0: "Not Clickbait", 1: "Clickbait"}

print(f"Text: {text}")
print(f"Prediction: {labels[predicted_class]} (Confidence: {confidence:.2f})")