CoolFace
Modelpublic

Arstacity/political-bias-classifier

sourceHugging Faceapache-2.0updated 11mo agoView on Hugging Face
0likes5downloads
Model Card

political-bias-classifier

![Hugging Face Model](https://huggingface.co/models?search=distilbert) ![License](https://www.apache.org/licenses/LICENSE-2.0)


๐Ÿ“– Model Description

The political-bias-classifier is a fine-tuned DistilBERT model designed for text classification to identify and categorize political bias within a given text.

This model is intended to analyze the political leaning expressed in textual content, such as news headlines, articles, or social media commentary.

DetailValue
Base ModelDistilBERT
Model TypeText Classification (Sequence Classification)
Weights FormatSafetensors (model.safetensors)
LicenseApache-2.0
File Size~268 MB

๐Ÿš€ Usage

You can easily use this model for inference with the Hugging Face transformers library.

Using the Pipeline

The simplest way to get a prediction is by using the pipeline abstraction:

python
from transformers import pipeline

# Initialize the classifier pipeline
classifier = pipeline(
    "text-classification", 
    model="Arstacity/political-bias-classifier"
)

# Example text for analysis
text_to_analyze = "The new trade bill is a crucial step towards economic growth, despite the opposition's claims of cronyism."

# Get the prediction
result = classifier(text_to_analyze)

print(result)
# Example Output Format (Actual labels and scores will vary): 
# [{'label': 'RIGHT_LEANING', 'score': 0.9542}]

Direct Model Loading

For more control, you can load the tokenizer and model directly:

python
from transformers import AutoModelForSequenceClassification, AutoTokenizer

model_name = "Arstacity/political-bias-classifier"

# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Load the model
model = AutoModelForSequenceClassification.from_pretrained(model_name)

# You are now ready to perform tokenization and inference.

Files in Repository

This repository contains all the necessary files for the DistilBERT model and tokenizer:

File NameDescription
model.safetensorsThe main model weights file (268 MB).
config.jsonConfiguration file for the model architecture
vocab.txtVocabulary file for the tokenizer
tokenizer.jsonThe tokenizer configuration file
tokenizer_config.jsonTokenizer metadata
special_tokens_map.jsonMapping for special tokens.

License: Apache 2.0 ---