Arstacity/political-bias-classifier
political-bias-classifier
 
๐ 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.
๐ 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:
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:
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:
License: Apache 2.0 ---
