This project extracts news articles related to a company, summarizes them, performs sentiment analysis, and generates a Hindi audio report.
Key Features:
Web Scraping for latest news (BeautifulSoup)
Summarization using Transformers (Hugging Face)
Sentiment Analysis (Positive, Negative, Neutral)
Comparative Sentiment Insights
Hindi TTS Audio Output (gTTS)
API Support for analysis & querying
API Support using Flask (api.py
)
Web UI using Gradio (app.py
)
Clone the Repository
git clone https://github.com/guruprashanth2004/news-summarization-tts.git
cd news-summarization-tts
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python api.py
python app.py
- Purpose: Summarizes news articles into concise summaries.
- Library Used:
transformers
- Purpose: Analyzes sentiment of news articles.
- Library Used:
transformers
- Model:
gTTS
(Google Text-to-Speech) - Purpose: Converts summarized sentiment analysis into Hindi speech.
- Library Used:
gtts
- Example Input:
"Tesla की हालिया खबरें ज्यादातर सकारात्मक हैं।"
- Example Output:
output.mp3
(Hindi speech file)
The backend API is built using Flask and provides two endpoints:
Purpose: Fetch news, summarize, analyze sentiment, and generate Hindi TTS.
Method: GET
URL:
http://127.0.0.1:5000/analyze?company=Tesla
Response:
{
"articles": [
{
"title": "Tesla Stock Hits New Highs",
"summary": "Tesla's stock price reached record levels...",
"sentiment": "Positive"
}
],
"comparison": {
"Sentiment Distribution": {"Positive": 1, "Negative": 0, "Neutral": 0}
},
"audio_file": "output.mp3"
}
Purpose: Fetch articles based on sentiment filter. Method: GET URL: http://127.0.0.1:5000/query?company=Tesla&sentiment=Positive Response:
{
"articles": [
{
"title": "Tesla's Profits Rise",
"summary": "Tesla reports record-breaking profits...",
"sentiment": "Positive"
}
]
}
API/Tool | Purpose |
---|---|
Bing News Scraping | Extracts latest news articles |
Hugging Face Transformers | Summarization & Sentiment Analysis |
Google Text-to-Speech (gTTS) | Converts sentiment report to Hindi speech |
- The news articles contain relevant information about the company.
- Sentiment analysis is reasonably accurate, but may misinterpret sarcasm.
- The Hindi TTS model correctly pronounces the text, but may have intonation issues.
- Web Scraping Issues:
- Some websites block bots (may require rotating proxies).
- Bing News doesn’t always provide full article content.
- Sentiment Model Limitations:
- Works well for English news, but doesn’t analyze Hindi news.
This application is deployed on Hugging Face Spaces.
🔗 Live Demo: https://huggingface.co/spaces/guru14102004/news-summarization-tts