ElectAI is a Machine Learning-powered web application that predicts voter turnout across U.S. states based on demographic and historical data. It features an interactive React frontend and a Flask backend integrated with a Scikit-learn linear regression model. Here are the inputs:
- Year
- Percent with Bachelors Degree or higher
- Average Income
- Percent of Population that is White
- Average Age

To run the project locally, you need:
- Python 3.8+ installed on your machine
- Node.js 14+ and npm (or yarn) installed
- A Python virtual environment (optional but recommended)
-
Navigate to the Backend Directory:
cd <repository-folder>/backend
-
Create a Virtual Environment:
python -m venv venv
-
Activate the Virtual Environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install Dependencies:
pip install -r requirements.txt
-
Run the Flask Server:
python server.py
The backend will start on
http://127.0.0.1:5000
by default.
-
Navigate to the Frontend Directory:
cd ../frontend
-
Install Dependencies:
npm install
Or, if you're using yarn:
yarn install
-
Start the Development Server:
npm run dev
Or, if you're using yarn:
yarn run dev
The frontend will start on
http://localhost:3000
by default.
Ensure the Flask backend is running before starting the React frontend. The React app is configured to send API requests to the Flask server at http://127.0.0.1:5000
.
- Open your browser and navigate to
http://localhost:3000
. - Interact with the inputs and observe predictions generated by the Flask backend.