The AI-Based Review Classifier is a machine learning-powered web application designed to classify customer reviews as Positive, Negative, or Neutral. The system integrates a Flask-based AI model with a Node.js backend and supports real-time classification.
- β Machine Learning-Based Sentiment Analysis
- β RESTful API for Classification
- β Preprocessing & Model Training Scripts
- β Flask API for AI Model Deployment
- β Secure Node.js Backend
- β Scalable & Modular Architecture
- β Automated Training & Evaluation
- β CI/CD & Deployment Support
User β Frontend β Backend (Node.js) β AI Model (Flask) β Database (MongoDB)
(for %i in (file1.txt test.js ) do type nul > %i) #To create multiple files at once
AI-Based-Review-Classifier/
βββ π backend/ # Backend (Node.js & Express)
β βββ π src/ # Source Code
β β βββ π config/ # Configuration files
β β β βββ db.js # MongoDB connection
β β β βββ envConfig.js # Environment variables handler
β β βββ π controllers/ # Route controllers
β β β βββ authController.js # Authentication logic
β β β βββ reviewController.js# Review-related logic
β β βββ π middleware/ # Middlewares
β β β βββ authMiddleware.js # JWT authentication
β β β βββ errorMiddleware.js # Error handling
β β βββ π models/ # Mongoose models
β β β βββ User.js # User schema
β β β βββ Review.js # Review schema
β β βββ π routes/ # API route handlers
β β β βββ authRoutes.js # Authentication routes
β β β βββ reviewRoutes.js # Review management routes
β β βββ π services/ # Business logic services
β β β βββ authService.js # User authentication logic
β β β βββ reviewService.js # Review processing logic
β β βββ π utils/ # Utility functions
β β β βββ jwtHelper.js # JWT token helpers
β β β βββ emailHelper.js # Email notifications
β β β βββ responseHandler.js # Standardized API responses
β β βββ app.js # Express app configuration
β β βββ server.js # Main server entry point
β βββ π tests/ # Backend tests
β β βββ authTests.js # Tests for authentication
β β βββ reviewTests.js # Tests for review management
β βββ .env # Environment variables
β βββ .gitignore # Ignore unnecessary files
β βββ Dockerfile # Dockerization support
β βββ package.json # Dependencies & scripts
β βββ package-lock.json # Lock file for package versions
β βββ postman_collection.json # API testing collection
β
βββ π ai_model/ # AI Model (Python & Machine Learning)
β βββ π data/ # Dataset storage
β β βββ reviews.csv # Raw dataset
β β βββ preprocessed.pkl # Preprocessed data
β β βββ model.pkl # Trained ML model
β β βββ vectorizer.pkl # TF-IDF vectorizer
β βββ π training/ # Training scripts
β β βββ preprocess.py # Data preprocessing
β β βββ train_model.py # Model training & saving
β β βββ evaluate.py # Model evaluation
β βββ π api/ # Flask API to expose model
β β βββ app.py # Flask API for predictions
β β βββ model_loader.py # Model loading utility
β β βββ requirements.txt # Python dependencies
β βββ π notebooks/ # Jupyter notebooks for experiments
β β βββ DataExploration.ipynb # Dataset exploration
β β βββ ModelTesting.ipynb # Model evaluation
β βββ π tests/ # Model testing scripts
β β βββ test_predictions.py # API testing for model predictions
β β βββ test_preprocessing.py # Test data preprocessing steps
β βββ ai_service.py # Python client to call Flask API
β
βββ π frontend/ # (Optional) React/Angular Frontend
β βββ src/ # Source code
β β βββ π components/ # React components
β β β βββ ReviewForm.js # Review submission form
β β β βββ ReviewList.js # Review display
β β β βββ Navbar.js # Navbar UI
β β βββ π pages/ # Application pages
β β β βββ HomePage.js # Home page UI
β β β βββ Dashboard.js # User dashboard
β β βββ π services/ # API call handlers
β β β βββ api.js # Backend API calls
β β βββ App.js # Main React component
β β βββ index.js # React app entry point
β βββ public/ # Static files (HTML, CSS)
β βββ package.json # Dependencies
β
βββ π docs/ # Documentation
β βββ API_Documentation.md # API usage and endpoints
β βββ AI_Model_Documentation.md # AI model details
β
βββ README.md # Project documentation
- Node.js, Express.js, MongoDB, Socket.io
- Nodemailer (Email notifications)
- Python, Flask, Scikit-Learn, TF-IDF
- Jupyter Notebooks (Experiments)
- React.js, TailwindCSS
| Method | Endpoint | Description |
|---|---|---|
POST |
/predict |
Classifies review |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/ai/classify |
Classifies user review |
GET |
/api/reviews |
Fetches all classified reviews |
git clone https://github.com/yourusername/AI-Based-Review-Classifier.git
cd AI-Based-Review-Classifiercd backend
npm installcd ai_model/api
pip install -r requirements.txtCreate a .env file in the backend/ folder:
MONGO_URI=your_mongo_db_connection_string
PORT=5000cd backend
npm startcd ai_model/api
python app.pyPOST http://localhost:5000/api/ai/classify
Body: { "review": "This product is amazing!" }
- Deploy on Heroku, AWS, or Vercel
- Use PM2 for process management
- Deploy Flask API on Render or Google Cloud
- Use Docker for containerization
- JWT Authentication
- CORS Handling
- Input Validation
- Grafana & Prometheus for API monitoring
- MLflow for AI model tracking
We welcome contributions! Follow these steps:
- Fork the repo
- Create a new branch (
feature-branch) - Commit your changes
- Create a Pull Request
This project is licensed under the MIT License. Feel free to modify and use it!
π Happy Coding! π