Logo Lanfrica

Lami14/loadshedding-sentiment-analyser

Domaine:

natural language processing

Type de record:

software
Créateur:
Lam
Hôte:
AI-powered sentiment analysis of South African load shedding opinions — HuggingFace RoBERTa model, Flask REST API, React dashboard. Full stack NLP app. # ⚡ LoadShedding Sentiment Analyser An AI-powered full stack web app that analyses public sentiment around South Africa's load shedding crisis. Uses a HuggingFace RoBERTa model trained on tweets to classify opinions as Positive, Negative, or Neutral — with a React frontend and Flask REST API backend. --- ## 📸 App Preview > *(Add a screenshot or GIF of your running app here)* --- ## ✨ Features - 🔍 **Live text analysis** — paste any tweet or statement and get instant sentiment - 📊 **Dashboard** — analyse 50 real load shedding tweets with summary stats and filtering - 🤗 **Twitter-trained model** — uses `cardiffnlp/twitter-roberta-base-sentiment-latest` - 🧹 **Tweet preprocessing** — cleans URLs, mentions and hashtags before inference - 📈 **Confidence scores** — shows model confidence percentage per prediction - 🎨 **Clean UI** — colour-coded results, filter by sentiment, responsive design --- ## 🏗️ Architecture ``` React Frontend (port 3000) │ │ HTTP POST /api/analyse │ HTTP GET /api/dashboard ▼ Flask REST API (port 5000) │ ▼ HuggingFace Transformers cardiffnlp/twitter-roberta-base-sentiment-latest ``` --- ## 📁 Project Structure ``` loadshedding-sentiment-app/ ├── backend/ │ ├── app.py # Flask REST API │ ├── sentiment.py # HuggingFace NLP engine │ ├── data/ │ │ └── loadshedding_tweets.csv # 50 sample tweets │ └── requirements.txt ├── frontend/ │ ├── public/index.html │ ├── src/ │ │ ├── App.jsx # Main app with tab navigation │ │ ├── components/ │ │ │ ├── SentimentForm.jsx # Text input + example buttons │ │ │ ├── SentimentResult.jsx # Result display with confidence bar │ │ │ ├── Dashboard.jsx # Stats + tweet feed │ │ │ └── TweetCard.jsx # Individual tweet card │ │ └── index.css │ └── package.json ├── .env.example ├── docker-compose.yml └── README.md ``` --- ## 🚀 Getting Started ### Option A — Run Manually **Backend:** ```bash cd …