MoodLens AI Emotion Detection from Text | Flask Machine Learning Final Year Project with Source Code
Back to ProjectFollow these in order. Do not skip step three, that is where most people get stuck.
pip install notebook if it is not already there.text column and an emotion column.Extract the downloaded zip somewhere sensible. Not Downloads. Then open a terminal inside that folder.
cd MoodLens
This keeps the project's packages separate from everything else on your system.
python -m venv venv
Then activate it. On Windows:
venv\Scripts\activate
On macOS or Linux:
source venv/bin/activate
You will know it worked because (venv) appears at the start of your terminal line.
pip install -r requirements.txt
Flask, scikit-learn, NLTK, pandas and the rest all come down together. Takes a couple of minutes on decent internet.
This is separate from the pip install and it trips up almost everybody. Run this exact command:
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords'); nltk.download('wordnet'); nltk.download('omw-1.4')"
Drop your CSV into the data/ folder. Open it once in Excel first and confirm the column names match what the training notebook expects. Renaming a column now saves you an hour later.
jupyter notebook emotion_detection_training.ipynb
Run every cell top to bottom. When it finishes, check that models/ now contains four files: tfidf_vectorizer.pkl, label_encoder.pkl, logistic_regression_model.pkl and metadata.pkl. If any one is missing, the app will not start.
python app.py
Open http://localhost:5000 in your browser.
Useful for generating screenshots for your report.
python -m transfer.engine --run-all
Or test a single domain pair:
python -m transfer.engine --train social --test forum
Results get cached into artifacts/ and the web Transfer Lab reads from there, so run this once before your demo and the page loads instantly.
Your virtual environment is not active. Look for (venv) in the terminal. If it is missing, run the activate command from step 2 again. This happens every time you close and reopen the terminal.
Step 4 did not complete. Re-run the NLTK download command. If your college network blocks it, connect to mobile hotspot for that one command.
Nine times out of ten the pickle files are missing or were built with a different scikit-learn version. Re-run the training notebook inside the same virtual environment you use to run the app.
Something else is holding the port, and on macOS it is usually AirPlay Receiver. Turn that off in system settings, or change the port in app.py to 5001.
All five working means you are done. Take screenshots now while it is running, not on submission day.
Our team is here to assist you with installation and setup.