Downloads · 30 days
8
30% of all-time downloads
Tasfiya025/FinancialNewsSentimentAnalyzer
FinancialNewsSentimentAnalyzer is a text classification model from Tasfiya025. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
This model is a RoBERTa-base sequence classification fine-tuned for analyzing the sentiment of financial market news headlines. It classifies headlines into one of three categories: Positive, Negative, or Neutral. The…
Downloads · 30 days
8
30% of all-time downloads
All-time downloads
27
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md2.1 KB · 46%
From the Hugging Face model README
This model is a RoBERTa-base sequence classification fine-tuned for analyzing the sentiment of financial market news headlines. It classifies headlines into one of three categories: Positive, Negative, or Neutral. The model is specifically optimized for short, impactful text snippets common in financial reporting.
The core architecture is based on the RoBERTa-base pre-trained language model.
This model is intended for:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "your_username/FinancialNewsSentimentAnalyzer" # Replace with actual hub path
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
headline = "Tesla Stock Surges 8% Following Unexpectedly Strong Q3 Delivery Numbers"
inputs = tokenizer(headline, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_id = logits.argmax().item()
predicted_label = model.config.id2label[predicted_class_id]
print(f"Headline: {headline}")
print(f"Predicted Sentiment: {predicted_label}")