|
--- |
|
license: apache-2.0 |
|
language: |
|
- en |
|
metrics: |
|
- accuracy |
|
pipeline_tag: text-classification |
|
tags: |
|
- news |
|
widget: |
|
- text: "Researchers have made significant progress in the development of a new treatment for a rare genetic disorder. Early trials of the treatment have shown promising results, with patients experiencing improvements in their symptoms and quality of life. This breakthrough offers hope to individuals and families affected by the condition, bringing them closer to a potential cure" |
|
--- |
|
|
|
# Fine-Tuned BERT News Classifier |
|
|
|
## Overview |
|
|
|
The Fine-Tuned BERT News Classifier is a natural language processing (NLP) model built upon the BERT architecture. It is specifically designed for news classification, providing a softmax output where a value of 1 indicates positive news and 0 indicates negative news sentiment. This model is trained to understand and categorize news articles, assisting in tasks such as sentiment analysis and news aggregation. |
|
|
|
## Usage Instructions |
|
|
|
### Import Necessary Libraries |
|
|
|
```python |
|
import tensorflow_text as text |
|
import tensorflow as tf |
|
``` |
|
|
|
### Load The Model |
|
|
|
```python |
|
from huggingface_hub import from_pretrained_keras |
|
|
|
model = from_pretrained_keras("weightedhuman/fine-tuned-bert-news-classifier") |
|
``` |
|
|
|
|
|
### Make Predictions |
|
|
|
```python |
|
examples = "Community Gardens Flourish, Bringing Fresh Produce and Unity to Neighborhoods" |
|
|
|
|
|
serving_results = model \ |
|
.signatures['serving_default'](tf.constant(examples)) |
|
|
|
|
|
serving_results = tf.sigmoid(serving_results['classifier']) |
|
|
|
serving_results_np = serving_results.numpy() |
|
|
|
for i in range(len(serving_results_np)): |
|
|
|
output_value = serving_results_np[i][0] |
|
|
|
print(output_value) |
|
``` |