JanhaviS14's picture
Update README.md
0348ac6 verified

A newer version of the Gradio SDK is available: 6.13.0

Upgrade
metadata
title: Finance Sentiment Mini
emoji: 🚀
colorFrom: green
colorTo: green
sdk: gradio
sdk_version: 6.1.0
app_file: app.py
pinned: false
short_description: Domain-aware sentiment analysis for financial text.
tags:
  - finance
  - sentiment analysis
  - NLP
  - FinBERT
  - text classification

Finance Sentiment Mini

A lightweight demo that analyzes the overall tone of financial statements and news using a finance-specific sentiment model. This Space is designed to show how domain-aware NLP models interpret financial language differently from general sentiment models. 👉 Try it live: https://huggingface.co/spaces/JanhaviS14/finance-sentiment-mini

What this Space does

Given a short financial sentence (for example, an earnings update or news headline), the model provides:

  • Overall assessment of the statement’s tone
  • Confidence score indicating how strongly the model supports that assessment

The model has been trained to recognize sentiment in financial and corporate communication, not generic reviews or social media text.

Model details

  • Base model: FinBERT
  • Fine-tuned on: Financial PhraseBank (sentences with high annotator agreement)
  • Classes: Positive / Neutral / Negative
  • Validation accuracy: ~98% on held-out data

Neutral statements in this context typically represent purely factual or informational content, such as disclosures, operational updates, or technical descriptions.

Model training

The sentiment model used in this Space was fine-tuned on the Financial PhraseBank dataset, which consists of manually annotated financial news sentences with high inter-annotator agreement.

  • Dataset: Financial PhraseBank (sentences with full agreement)
  • Training setup: Supervised fine-tuning of FinBERT for 3-class classification (positive / neutral / negative)
  • Evaluation: Held-out validation split
  • Validation accuracy: ~98%

The fine-tuned model is publicly available here:
👉 https://huggingface.co/JanhaviS14/finance-sentiment-mini-finbert

The training pipeline covers dataset preparation, label handling, stratified splits, fine-tuning, and evaluation before deployment in this Space.

How to use

Here’s a short example of how to load the fine-tuned model in Python:

from transformers import pipeline

clf = pipeline(
    "text-classification",
    model="JanhaviS14/finance-sentiment-mini-finbert",
    tokenizer="JanhaviS14/finance-sentiment-mini-finbert"
)

print(clf("The company raised guidance after beating expectations."))

How to interpret results

  • Positive → Clear improvement, growth, or favorable outcome
  • Negative → Clear risk, deterioration, or unfavorable development
  • Neutral → Informational statements without an explicit positive or negative signal

Some sentences may contain mixed signals (e.g. revenue growth alongside margin pressure). In such cases, the model may show lower confidence or closely spaced scores, which reflects genuine ambiguity in financial language.

The model works best on:

  • Short financial statements and news headlines
  • Earnings call highlights
  • Corporate press releases

It may be less reliable for:

  • General social media posts
  • Long narrative text without clear sentiment

Example inputs

You can try sentences like:

  • “The company reported record quarterly profits and raised its full-year guidance.”
  • “Earnings missed estimates as higher input costs impacted profitability.”
  • “The firm disclosed changes in shareholding structure.”
  • “Revenue grew modestly, while operating expenses also increased.”

Why this exists

General sentiment models are often trained on product reviews or social text and can misinterpret financial terminology. This Space demonstrates how finance-tuned models better capture the nuance of earnings, disclosures, and corporate updates.

Disclaimer

This tool is for educational and exploratory purposes only. It should not be used as financial advice or as the sole basis for investment decisions.