How aonsanti/mbti-and-sentiment-prediction works
WebAI is a text-analysis application for IMDB sentiment and MBTI personality prediction. Users choose an analysis page, submit text through a shared frontend hook, and receive a prediction and model metadata from the API; the sentiment path additionally applies VADER to short text. Separate training programs prepare and save model artifacts. The API and frontend excerpts show these runtime links; training-to-artifact links are documented by the README and source index, while unsampled model-training details are not expanded.
Main entry points: App.jsx App routing · train_ml.py Sentiment training · main.py Sentiment inference · train_nn.py MBTI training
Components 22
Web interface
- App routing
Frontend/src/App.jsx - Home page
Frontend/src/pages/Home.jsx - Header
Frontend/src/component/Header.jsx - Footer
Frontend/src/component/Footer.jsx - Sentiment page
Frontend/src/pages/MachineLearning.jsx - MBTI page
Frontend/src/pages/NeuralNetwork.jsx - Model hook
Frontend/src/hooks/useModel.js - Demo predictions
Frontend/src/utils/demoPredictions.js
Prediction API
- API endpoints
Backend/main.py
Inference and artifacts
- Text cleaning
Backend/preprocess.py - Sentiment inference
Backend/main.py - MBTI inference
Backend/main.py - VADER override
Backend/main.py - Sentiment model
Models/ml_model.pkl - TF-IDF vectorizer
Models/ml_vectorizer.pkl - MBTI model
Models/nn_model.pkl - Sentiment metrics
Models/ml_metrics.json - MBTI metrics
Models/nn_metrics.json
Model training
- Sentiment training
Backend/train_ml.py - MBTI training
Backend/train_nn.py - Training datasets
Dataset
Other components
- Text analyst
Connections 28
- Text analyst → App routing: uses
README.md - App routing → Home page: routes to
Frontend/src/App.jsx - App routing → Sentiment page: routes to
Frontend/src/App.jsx - App routing → MBTI page: routes to
Frontend/src/App.jsx - App routing → Header: renders
Frontend/src/App.jsx - App routing → Footer: renders
Frontend/src/App.jsx - Sentiment page → Model hook: requests prediction
Frontend/src/pages/MachineLearning.jsx - MBTI page → Model hook: requests prediction
Frontend/src/pages/NeuralNetwork.jsx - Model hook → API endpoints: calls API
Frontend/src/hooks/useModel.js - Model hook → Demo predictions: uses fallback
Frontend/src/hooks/useModel.js - API endpoints → Text cleaning: cleans text
Backend/main.py - API endpoints → Sentiment inference: dispatches sentiment
Backend/main.py - API endpoints → MBTI inference: dispatches MBTI
Backend/main.py - Sentiment inference → Sentiment model: loads and predicts
Backend/main.py - Sentiment inference → TF-IDF vectorizer: transforms text
Backend/main.py - Sentiment inference → VADER override: checks short text
Backend/main.py - Sentiment inference → Sentiment metrics: reads metrics
Backend/main.py - MBTI inference → MBTI model: loads and predicts
Backend/main.py - MBTI inference → MBTI metrics: reads metrics
Backend/main.py - Sentiment training → Text cleaning: uses cleaning
Backend/train_ml.py - Sentiment training → Training datasets: reads reviews
Backend/train_ml.py - Sentiment training → Sentiment model: saves model
Backend/train_ml.py - Sentiment training → TF-IDF vectorizer: saves vectorizer
Backend/train_ml.py - Sentiment training → Sentiment metrics: writes metrics
Backend/train_ml.py - MBTI training → Text cleaning: uses cleaning
Backend/train_nn.py - MBTI training → Training datasets: trains on
- MBTI training → MBTI model: produces model
- MBTI training → MBTI metrics: produces metrics