Update README.md
Browse files
README.md
CHANGED
@@ -1,67 +1,79 @@
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: News Sentiment Analyzer
|
3 |
+
emoji: 🐨
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: blue
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.43.2
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
short_description: 'simple app to analyze news sentiment '
|
11 |
+
---
|
12 |
+
|
13 |
+
# News Summarization & Sentiment Analysis
|
14 |
+
|
15 |
+
## Overview
|
16 |
+
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.
|
17 |
+
|
18 |
+
## Features
|
19 |
+
- **News Extraction:** Fetches news articles using NewsAPI and scrapes additional content when available.
|
20 |
+
- **Sentiment Analysis:** Categorizes each article as Positive, Negative, or Neutral.
|
21 |
+
- **Comparative Analysis:** Provides an overview of sentiment distribution across articles.
|
22 |
+
- **Text-to-Speech:** Converts summarized news titles into Hindi speech.
|
23 |
+
- **Web Interface:** Allows users to input a company name via a Streamlit UI.
|
24 |
+
- **API Integration:** Backend developed using FastAPI to communicate with the frontend.
|
25 |
+
|
26 |
+
## Installation
|
27 |
+
### Prerequisites
|
28 |
+
Ensure you have Python installed (>= 3.8). Install the required dependencies:
|
29 |
+
|
30 |
+
```bash
|
31 |
+
pip install requests nltk beautifulsoup4 gtts deep-translator streamlit fastapi pydantic uvicorn
|
32 |
+
```
|
33 |
+
|
34 |
+
### Download NLTK Data
|
35 |
+
To enable sentiment analysis, run:
|
36 |
+
```python
|
37 |
+
import nltk
|
38 |
+
nltk.download('vader_lexicon')
|
39 |
+
```
|
40 |
+
|
41 |
+
## Usage
|
42 |
+
### Running the FastAPI Backend
|
43 |
+
Start the FastAPI server using:
|
44 |
+
```bash
|
45 |
+
uvicorn news:app --reload
|
46 |
+
```
|
47 |
+
|
48 |
+
### Running the Streamlit UI
|
49 |
+
Launch the web application:
|
50 |
+
```bash
|
51 |
+
streamlit run news.py
|
52 |
+
```
|
53 |
+
|
54 |
+
## API Endpoints
|
55 |
+
- `POST /get_news/`
|
56 |
+
- **Request Body:**
|
57 |
+
```json
|
58 |
+
{ "company": "Tesla" }
|
59 |
+
```
|
60 |
+
- **Response:**
|
61 |
+
```json
|
62 |
+
{
|
63 |
+
"articles": [...],
|
64 |
+
"sentiment_summary": {"Positive": 3, "Negative": 4, "Neutral": 3}
|
65 |
+
}
|
66 |
+
```
|
67 |
+
|
68 |
+
## Deployment
|
69 |
+
- **Deploy FastAPI Backend:** Use services like **AWS, Heroku, or Render**.
|
70 |
+
- **Deploy Streamlit UI:** Host on **Streamlit Cloud or Hugging Face Spaces**.
|
71 |
+
|
72 |
+
## Acknowledgments
|
73 |
+
- [NewsAPI](https://newsapi.org/) for fetching news.
|
74 |
+
- [NLTK](https://www.nltk.org/) for sentiment analysis.
|
75 |
+
- [Google Translate API](https://pypi.org/project/deep-translator/) for Hindi translation.
|
76 |
+
- [Streamlit](https://streamlit.io/) for the UI.
|
77 |
+
- [FastAPI](https://fastapi.tiangolo.com/) for backend API.
|
78 |
+
|
79 |
+
|