Skip to content

🗳️ Indian Election Predictor - AI-powered sentiment analysis web app that predicts election outcomes using Twitter data & NLP. Features real-time analysis, interactive Plotly charts, modern UI with glassmorphism design. Built with Flask, TextBlob, Pandas. Analyzes Modi vs Rahul Gandhi sentiment data.

License

Notifications You must be signed in to change notification settings

Avisav24/IndianElection_ResultPredictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🇮🇳 Indian Election Predictor

AI-Powered Sentiment Analysis for Election Predictions

Python Version Flask Version License Status

A sophisticated web application that analyzes Twitter sentiment to predict election outcomes using AI-powered Natural Language Processing


🚀 Key Features

Feature Description
🔍 Sentiment Analysis Advanced TextBlob NLP for Twitter sentiment analysis
📊 Interactive Visualizations Beautiful charts and graphs using Plotly.js
🎨 Modern UI Responsive design with glassmorphism effects
Real-time Analysis Dynamic loading and results presentation
🏛️ Professional Dashboard Clean interface with Indian flag colors

🔥 What Makes This Special?

  • 🎨 Modern UI: Glassmorphism design with smooth animations
  • 📊 Interactive Charts: Real-time data visualization
  • 🎯 Accurate Predictions: AI-powered sentiment analysis
  • 📱 Responsive Design: Works on all devices
  • 🇮🇳 Indian Theme: Flag colors and cultural elements
  • Fast Performance: Optimized for speed and efficiency

📂 Project Structure

Indian-Election-Sentiment-Analysis/
├── 🐍 app.py                         # Flask backend application
├── 📋 requirements.txt               # Python dependencies
├── 📄 README.md                      # Project documentation
├── 📁 data/                          # Data files
│   ├── 📊 modi_reviews.csv           # Modi sentiment data
│   └── 📊 rahul_reviews.csv          # Rahul Gandhi sentiment data
├── 📁 static/                        # Static files
│   ├── 🎨 css/                       # Stylesheets
│   │   └── style.css                 # Main CSS file
│   ├── ⚡ js/                        # JavaScript files
│   │   └── script.js                 # Main JavaScript file
│   └── 🖼️ images/                    # Image files
│       ├── Prime_Minister_Of_Bharat_Shri_Narendra_Damodardas_Modi.jpg
│       └── Rahul_Gandhi.png
└── 📁 templates/                     # HTML templates
    └── index_clean.html              # Clean template

🛠️ Installation & Setup

Prerequisites

  • Python 3.8+
  • pip package manager
  • Git

Quick Start

  1. 📥 Clone the repository

    git clone https://github.com/Avisav24/IndianElection_ResultPredictor.git
    cd IndianElection_ResultPredictor
  2. 🐍 Create virtual environment

    python -m venv venv
    # On Windows:
    venv\Scripts\activate
    # On macOS/Linux:
    source venv/bin/activate
  3. 📦 Install dependencies

    pip install -r requirements.txt
  4. 🚀 Run the application

    python app.py
  5. 🌐 Open in browser

    Navigate to http://localhost:5000

🎉 That's it! Your application is now running!

📱 Usage Guide

Step-by-Step Process

  1. 🏠 Homepage

    • View political candidates and their information
    • See candidate profiles with images
  2. 📊 Analyze

    • Click the "Analyze Sentiment" button
    • Watch the real-time progress indicator
  3. 📈 Results

    • View detailed sentiment statistics
    • See prediction results with confidence scores
    • Explore interactive charts and visualizations
  4. 🎯 Charts

    • Interactive bar charts showing sentiment distribution
    • Pie charts for quick visual understanding
    • Hover effects for detailed information

🔧 Technical Architecture

🎛️ Backend Technologies

Technology Purpose Version
Flask Web Framework 2.0+
Python Core Language 3.8+
TextBlob Sentiment Analysis Latest
Pandas Data Processing Latest
NumPy Numerical Computing Latest
Plotly Chart Generation Latest

🎨 Frontend Technologies

Technology Purpose Features
HTML5 Markup Semantic, Accessible
CSS3 Styling Glassmorphism, Animations
JavaScript Interactivity ES6+, Async/Await
Plotly.js Visualization Interactive Charts

📊 Data Processing Pipeline

graph TD
    A[Twitter CSV Data] --> B[Data Loading]
    B --> C[Text Preprocessing]
    C --> D[TextBlob Analysis]
    D --> E[Sentiment Classification]
    E --> F[Statistical Analysis]
    F --> G[Chart Generation]
    G --> H[Web Display]
Loading

🗄️ Data Sources

  • Format: CSV files with Twitter sentiment data
  • Processing: Real-time sentiment analysis using TextBlob
  • Visualization: Multiple chart types for comprehensive analysis
  • Caching: Optimized performance with intelligent caching

🛡️ API Endpoints

Method Endpoint Description Response
GET / Homepage HTML Template
GET /analyze Sentiment Analysis JSON Results
GET /static/<path> Static Files CSS/JS/Images

📋 API Response Format

{
  "status": "success",
  "data": {
    "sentiment_stats": {
      "positive": 45.2,
      "negative": 32.1,
      "neutral": 22.7
    },
    "prediction": {
      "winner": "Candidate Name",
      "confidence": 78.5
    },
    "charts": {
      "bar_chart": "plotly_json",
      "pie_chart": "plotly_json"
    }
  }
}

🤝 Contributing

We welcome contributions! Here's how you can help:

🚀 Quick Contribution Steps

  1. 🍴 Fork the repository

    Click the "Fork" button at the top right

  2. 📥 Clone your fork

    git clone https://github.com/your-username/IndianElection_ResultPredictor.git
    cd IndianElection_ResultPredictor
  3. 🌿 Create a feature branch

    git checkout -b feature/amazing-feature
  4. ✨ Make your changes

    • Follow the existing code style
    • Add comments for complex logic
    • Test your changes
  5. 📝 Commit your changes

    git commit -m "✨ Add amazing feature"
  6. 🚀 Push to your branch

    git push origin feature/amazing-feature
  7. 🔄 Open a Pull Request

    Go to the repository and click "New Pull Request"

💡 Contribution Ideas

  • 🎨 UI/UX improvements
  • 📊 New chart types
  • 🔧 Performance optimizations
  • 🐛 Bug fixes
  • 📝 Documentation improvements
  • 🌐 Internationalization
  • 📱 Mobile enhancements

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License - Feel free to use, modify, and distribute!

⚠️ Important Disclaimer

Note: This prediction is based solely on Twitter sentiment analysis and should not be considered as a definitive election forecast.

Actual election results depend on many factors including:

  • Voter turnout patterns
  • Regional preferences
  • Ground-level campaign effectiveness
  • Socio-economic factors
  • Last-minute political developments

🆘 Support & Help

Need help? We're here for you!

🎉 Acknowledgments

  • 🙏 Thanks to all contributors
  • 📚 TextBlob for NLP capabilities
  • 📊 Plotly for beautiful visualizations
  • 🌐 Flask for the web framework
  • 🎨 CSS Glassmorphism community

Made with ❤️ in India
© 2025 Indian Election Predictor | Powered by TextBlob NLP & Plotly

Made with love Made in India Powered by AI

About

🗳️ Indian Election Predictor - AI-powered sentiment analysis web app that predicts election outcomes using Twitter data & NLP. Features real-time analysis, interactive Plotly charts, modern UI with glassmorphism design. Built with Flask, TextBlob, Pandas. Analyzes Modi vs Rahul Gandhi sentiment data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published