--- tags: - text-classification - distilbert - political-bias - safetensors license: apache-2.0 --- # political-bias-classifier [![Hugging Face Model](https://img.shields.io/badge/Model%20Type-DistilBERT-blue.svg)](https://huggingface.co/models?search=distilbert) [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](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. | Detail | Value | | :--- | :--- | | **Base Model** | DistilBERT | | **Model Type** | Text Classification (Sequence Classification) | | **Weights Format**| Safetensors (`model.safetensors`) | | **License** | Apache-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 Name | Description | | :--- | :--- | | **model.safetensors** | The main model weights file (268 MB). | | **config.json** | Configuration file for the model architecture | | **vocab.txt**| Vocabulary file for the tokenizer | | **tokenizer.json** | The tokenizer configuration file | | **tokenizer_config.json** | Tokenizer metadata | | **special_tokens_map.json** | Mapping for special tokens. | *** License: Apache 2.0 ---