Prince-29's picture
Update README.md
f952260

A newer version of the Streamlit SDK is available: 1.44.1

Upgrade
metadata
title: News Sentiment Analyzer
emoji: 🐨
colorFrom: gray
colorTo: blue
sdk: streamlit
sdk_version: 1.43.2
app_file: app.py
pinned: false
short_description: 'simple app to analyze news sentiment '

News Summarization & Sentiment Analysis

Overview

This project is a web-based application that extracts news articles related to a given company, performs sentiment analysis, generates a comparative analysis, and converts the summarized content into Hindi speech.

Features

  • News Extraction: Fetches news articles using NewsAPI and scrapes additional content when available.
  • Sentiment Analysis: Categorizes each article as Positive, Negative, or Neutral.
  • Comparative Analysis: Provides an overview of sentiment distribution across articles.
  • Text-to-Speech: Converts summarized news titles into Hindi speech.
  • Web Interface: Allows users to input a company name via a Streamlit UI.
  • API Integration: Backend developed using FastAPI to communicate with the frontend.

Installation

Prerequisites

Ensure you have Python installed (>= 3.8). Install the required dependencies:

pip install requests nltk beautifulsoup4 gtts deep-translator streamlit fastapi pydantic uvicorn

Download NLTK Data

To enable sentiment analysis, run:

import nltk
nltk.download('vader_lexicon')

Usage

Running the FastAPI Backend

Start the FastAPI server using:

uvicorn news:app --reload

Running the Streamlit UI

Launch the web application:

streamlit run news.py

API Endpoints

  • POST /get_news/
    • Request Body:
      { "company": "Tesla" }
      
    • Response:
      {
        "articles": [...],
        "sentiment_summary": {"Positive": 3, "Negative": 4, "Neutral": 3}
      }
      

Deployment

  • Deploy FastAPI Backend: Use services like AWS, Heroku, or Render.
  • Deploy Streamlit UI: Host on Streamlit Cloud or Hugging Face Spaces.

Acknowledgments