File size: 2,575 Bytes
4284273
e22e611
 
 
 
 
 
 
4284273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a7ac876
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: News Summarizer
emoji: 📰
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.22.0
app_file: app.py
pinned: false
---

# Live Company News Analyzer 
**A project by Sara Nimje - [Visit Portfolio Website](https://saranimje.github.io/)**
This application fetches live news articles for a company, analyzes sentiment, summarizes content, and converts it into Hindi audio. 
## Objective:
I have developed a web-based application that extracts key details from multiple news articles related to a given company. The application performs sentiment analysis, conducts a comparative analysis, and generates a text-to-speech (TTS) output in Hindi. Users can input a company name and receive a structured sentiment report along with an audio summary, making the information more accessible and insightful.
# Project Setup
## Installation:

 - Clone this repository -
`git clone https://github.com/saranimje/news-summarizer.git `
- Navigate to directory -
`cd news-summarizer`

 - Install Dependencies - 
 `pip install -r requirements.txt`
    
 - Run Gradio App - 
 `python app.py`
    
 - Run API (Optional) - 
 `uvicorn api:app --reload`

# Model Details
## Summarization Model
 - Uses transformers from Hugging Face.
 - Model: `google/long-t5-tglobal-base`

## Sentiment Analysis
Uses default sentiment-analysis pipeline from Hugging Face.

## Topic Modelling
-   Uses TF-IDF vectorization with NMF (Non-Negative Matrix Factorization) to extract key topics from news articles.
-   Utilizes cosine similarity to measure relationships between articles.

## Text-to-Speech 
Uses `gTTS (Google Text-to-Speech)`
## Translation
Uses `GoogleTranslator` (source: English, target: Hindi).


# API Development
This project includes a **FastAPI-based API** to fetch news articles and analyze them.
## **Endpoints:**
**1. Home**
-   `GET /`
-   Returns: `{"message": "News Summarization API is running!"}`   
**2. Fetch News**
-   `GET /news/?company_name=Tesla&article_number=5`
-   Returns JSON output containing news articles and analysis.
# API Development
## Using Postman or Curl:
1.  Open **Postman** or any API testing tool.
2.  Send a `GET` request to:
   ` http://127.0.0.1:8000/news/?company_name=Tesla&article_number=5`
3.  View JSON response with news articles and summaries.

## Third-Party API Usage
-   **News Sources**: Google Search (`googlesearch` Python module).
-   **Libraries Used**:
    - `requests` for API calls
    - `gensim`, `deep_translator`, `nltk` for text processing.
    - `googlesearch` to fetch news links.
    - `feedparser` for RSS feeds.