Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💬 ML Sentiment Web App

Python scikit-learn Streamlit License: MIT

An end-to-end machine-learning web app: it trains a sentiment classifier, persists it, and serves live predictions through a clean Streamlit interface.

Part of Hamza Naeem's AI portfolio.

✨ Features

  • Full ML lifecycle — train → save (joblib) → load → predict, not just a script.
  • Clean separation — model logic in model.py (unit-tested), UI in streamlit_app.py.
  • Interactive UI — type text, get a positive/negative label with a confidence bar.
  • Testedpytest suite covers training, prediction, persistence, and accuracy.

🚀 Quick start

git clone https://github.com/hamzanaeem627/ml-sentiment-webapp.git
cd ml-sentiment-webapp
pip install -r requirements.txt
streamlit run streamlit_app.py

Then open the local URL Streamlit prints (usually http://localhost:8501).

🧠 Use the model directly (no UI)

from model import SentimentModel

model = SentimentModel.load_or_train()
print(model.predict("I absolutely loved this"))
# {'label': 'positive', 'confidence': 0.78, 'positive_probability': 0.78}

🧪 Tests

pytest

🗂️ Structure

model.py          # TF-IDF + Logistic Regression pipeline (train/save/load/predict)
streamlit_app.py  # thin Streamlit UI
test_model.py     # pytest suite

🔧 Extending

Swap SEED_DATA in model.py for your own labeled dataset (list of (text, label) where 1 = positive, 0 = negative) to train on real data.

👤 About

Built by Hamza Naeem — AI Engineer. Portfolio · LinkedIn · GitHub

📄 License

MIT

About

End-to-end ML web app: trains, saves, and serves a sentiment classifier via Streamlit. Python + scikit-learn.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages