cd /news/machine-learning/built-a-sentiment-analysis-web-app-m… · home topics machine-learning article
[ARTICLE · art-14948] src=dev.to pub= topic=machine-learning verified=true sentiment=↑ positive

Built a Sentiment Analysis Web App – My First Full-Stack ML Project

A developer built a full-stack sentiment analysis web app as their first machine learning project, using a Random Forest model with Scikit-Learn and TF-IDF vectorization on the backend and React on the frontend. The app provides real-time positive or negative predictions with confidence scores and prediction history. The project highlighted challenges including model bias toward positive predictions due to small training data and version conflicts between Colab and local environments.

read1 min publishedMay 27, 2026

Hey dev.to 👋

After spending a month learning Machine Learning through Andrew Ng’s specialization, I wanted to build something real — not just notebooks.

So I created a Sentiment Analysis Web App — a full-stack project that takes any text and predicts whether it's Positive or Negative.

What I Built

Frontend: React with clean, modern UI #

Backend: Flask API #

ML Model: Random Forest using Scikit-Learn + TF-IDF #

Features: Real-time prediction, confidence score, prediction history

Tech Stack

- React (frontend)
- Flask + Flask-CORS (backend)
- Scikit-Learn (RandomForestClassifier)
- TF-IDF Vectorizer for text processing

What I Learned

From theory to practice — Going from notebooks to a real web app was the biggest leap. #

Connecting frontend and backend — Handling API calls, CORS, and state management. #

Model limitations — Small training data leads to bias. I learned the hard way why pre-trained models or larger datasets matter. #

Full-stack thinking — ML is not just about the model. Deployment, UI/UX, and user experience are equally important.

Challenges I Faced

  • Version conflicts between Colab and local environment
  • Model bias toward "Positive" predictions

Project Structure

sentiment-analysis/

├── backend/ # Flask API + ML model

│ ├── app.py

│ ├── train_model.py

│ └── sentiment_model.pkl

└── frontend/ # React application

├── src/

└── package.json

GitHub Repo: You can check out the full project here:

[machine-learning-projects](https://github.com/ElchinNasirov/machine-learning-projects)

(Go to `projects/sentiment-analysis/`

folder)

How to Run Locally

cd backend

python3 train-model.py

python3 app.py

cd frontend

npm start

What's Next?

I’m continuing to study ML and will be sharing more projects:

  • Image classification
  • Recommendation systems
- More full-stack ML apps

If you're also learning ML, I'd love to hear your journey in the comments!
── more in #machine-learning 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/built-a-sentiment-an…] indexed:0 read:1min 2026-05-27 ·