Jiahuita
Add model files and API implementation
1d3834b
|
raw
history blame
1.8 kB
metadata
license: mit
tags:
  - text-classification
  - tensorflow
  - news-classification
pipeline_tag: text-classification
widget:
  - text: Enter your news headline here
datasets:
  - custom_news_dataset
model-index:
  - name: news-source-classifier
    results:
      - task:
          type: text-classification
          name: News Source Classification
        metrics:
          - type: accuracy
            value: 0.82
            name: Test Accuracy

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:

import requests

# Make a prediction
response = requests.post(
    "https://your-app-url/predict",
    json={"text": "Your news headline here"}
)
print(response.json())

Or use it locally:

from transformers import pipeline

classifier = pipeline("text-classification", model="your-username/news-source-classifier")
result = classifier("Your news headline here")
print(result)

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.