File size: 2,393 Bytes
58c342a b2de734 d6be1a6 58c342a 1d3834b 8b18a27 8b4bf9e 1d3834b 8b4bf9e d6be1a6 8b4bf9e d6be1a6 8b4bf9e 58c342a 1d3834b 8cc42bc 1d3834b 700431a 1d3834b 5aafe28 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
---
title: News Source Classifier
emoji: 📰
colorFrom: blue
colorTo: red
sdk: fastapi
sdk_version: 0.95.2
app_file: app.py
pinned: false
language: en
license: mit
tags:
- text-classification
- news-classification
- LSTM
- tensorflow
pipeline_tag: text-classification
widget:
- example_title: "Crime News Headline"
text: "Wife of murdered Minnesota pastor hired 3 men to kill husband after affair: police"
- example_title: "Science News Headline"
text: "Scientists discover breakthrough in renewable energy research"
- example_title: "Political News Headline"
text: "Presidential candidates face off in heated debate over climate policies"
model-index:
- name: News Source Classifier
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: Custom Dataset
type: Custom
metrics:
- name: Accuracy
type: accuracy
value: 0.82
---
# News Source Classifier
This model classifies news headlines as either Fox News or NBC News using an LSTM neural network.
## Model Description
- **Model Architecture**: LSTM Neural Network
- **Input**: News headlines (text)
- **Output**: Binary classification (Fox News vs NBC)
- **Training Data**: Large collection of headlines from both news sources
- **Performance**: Achieves approximately 82% accuracy on the test set
## Usage
You can use this model directly with a FastAPI endpoint:
```python
import requests
response = requests.post(
"https://huggingface.co/Jiahuita/NewsSourceClassification",
json={"text": "Your news headline here"}
)
print(response.json())
```
Or use it locally:
```python
from transformers import pipeline
classifier = pipeline("text-classification", model="Jiahuita/NewsSourceClassification")
result = classifier("Your news headline here")
print(result)
```
Example response:
```json
{
"label": "foxnews",
"score": 0.875
}
```
## Limitations and Bias
This model has been trained on news headlines from specific sources and time periods, which may introduce certain biases. Users should be aware of these limitations when using the model.
## Training
The model was trained using:
- TensorFlow 2.13.0
- LSTM architecture
- Binary cross-entropy loss
- Adam optimizer
## License
This project is licensed under the MIT License. |