Live Demo | Architecture Diagram
A production-grade MLOps system combining traditional ML with RAG for retail demand forecasting. Features real-time data streaming, automated model retraining, and AI-powered data analysis over 3M+ records.
Key Capabilities:
- ๐ Live data ingestion (10-min intervals)
- ๐ค RAG-powered Q&A over 3M+ sales records
- ๐ Dual forecasting (XGBoost + Prophet)
- ๐๏ธ What-if scenario analysis
- ๐จ Premium glassmorphism UI
- โก Zero-cost serverless infrastructure
Kaggle (train.csv) โ GitHub Action โ producer_batch.py โ Redis Stream โ feature_store_batch.py โ Upstash Redis
- Downloads 3M+ records from Kaggle
- Simulates 50 random transactions with current timestamps
- Pushes to Redis Stream
- Aggregates into daily/weekly/monthly features
- Stores in Redis for dashboard
Historical Data + Redis Buffer โ train.py โ XGBoost + Prophet โ MLflow โ Save Models โ Git Commit โ Auto-Deploy
- Merges Kaggle data with live Redis buffer
- Trains XGBoost on 12 features (oil, transactions, store metadata, holidays)
- Trains Prophet for long-term trends
- Saves
best_model_v2.json,long_term_forecast.pkl, encoders - Commits to repo โ Streamlit Cloud auto-deploys
User Input โ Load Models โ Encode Features โ Fetch Redis Data โ XGBoost.predict() โ Display Chart
- User selects store/product/date
- Loads XGBoost model and encoders
- Fetches live oil price and transactions from Redis
- Runs prediction
- Shows 7-day forecast
User Adjusts (Oil/Promo/Holiday) โ Modify Features โ XGBoost.predict() โ Compare Baseline vs Scenario โ Show Impact
- User tweaks scenario parameters
- Creates two feature sets (baseline vs scenario)
- Runs predictions for both
- Displays side-by-side comparison
train.csv โ Load 500K Recent Records โ Embeddings โ Pinecone (Cloud) โ Daily Updates
- Loads 500K most recent records
- Generates text: "Date: 2017-12-25, Store: 5, Product: GROCERY, Sales: $1234"
- Creates 384-dim embeddings (Sentence Transformers)
- Uploads to Pinecone via API
- Daily workflow adds new records automatically
Question โ Parse Filters โ Generate Embedding โ Pinecone Search โ Retrieve Top-20 โ Groq API โ Answer
- User asks: "What were GROCERY sales in store 25?"
- Extracts filters:
{store_nbr: 25, family: GROCERY} - Searches 500K+ vectors using semantic similarity
- Retrieves top 20 matching records from Pinecone
- Sends to Groq (Llama 3.3 70B) with context
- Generates answer with citations
User Visits โ Connect Pinecone โ Load Models โ Connect Redis โ Ready!
- Connects to Pinecone (cloud-hosted)
- No download needed (instant access)
- Loads ML models from repo
- Connects to Redis for live data
- App ready to serve in seconds
| Category | Technologies |
|---|---|
| Data | Kaggle API, Redis Streams, Upstash Redis |
| ML | XGBoost, Prophet, Sentence Transformers |
| AI | Groq (Llama 3.3 70B), Pinecone, Sentence Transformers |
| MLOps | GitHub Actions, MLflow, Streamlit Cloud |
- Live sales metrics from Redis
- 7-day XGBoost + 30-day Prophet forecasts
- Interactive Plotly charts
- Simulate oil price changes ($40-$120)
- Toggle promotions and holidays
- Instant prediction updates
- Natural language queries over 500K+ vectors
- Cloud-hosted semantic search via Pinecone
- Sub-2s responses via Groq API
Example Questions:
"What were total GROCERY sales in store 25?"
"Show sales trends for December 2017"
"Which stores had highest sales last week?"
git clone https://github.com/RobinMillford/retail-forecast.git
cd retail-forecast
pip install -r requirements.txt# Required
UPSTASH_REDIS_REST_URL=your_redis_url
UPSTASH_REDIS_REST_TOKEN=your_redis_token
GROQ_API_KEY=your_groq_key
# For Vector DB (Pinecone)
PINECONE_API_KEY=your_pinecone_key
PINECONE_ENVIRONMENT=us-east-1-aws
PINECONE_INDEX_NAME=retail-sales
# Optional
KAGGLE_USERNAME=your_username
KAGGLE_KEY=your_api_keystreamlit run dashboard.pypython scripts/pinecone_initial_load.pyretail_mlops/
โโโ .github/workflows/ # 3 automated pipelines
โโโ pages/ # What-If + AI Analyst
โโโ scripts/ # Vector DB builders
โโโ utils/ # Shared modules
โโโ dashboard.py # Main app
โโโ train.py # Model training
โโโ *.joblib, *.json, *.pkl # Model artifacts
- Get key: https://console.groq.com/
- Add to
.env:GROQ_API_KEY=gsk_...
- Sign up: https://www.pinecone.io/
- Create index:
retail-sales(384 dimensions, cosine) - Get API key from dashboard
- Add to
.env:PINECONE_API_KEY=your-key PINECONE_ENVIRONMENT=us-east-1-aws PINECONE_INDEX_NAME=retail-sales
- Vector DB: 500K+ vectors, 384-dim embeddings (Pinecone)
- Query Latency: <2s (search + LLM)
- Model Accuracy: RMSE ~500
- Uptime: 99.9% (Streamlit Cloud + Pinecone)
- FastAPI deployment
- LSTM/Transformer models
- Real-time alerts
- A/B testing framework
Yamin Hossain | GitHub
Kaggle โข Groq โข Pinecone โข Streamlit โข Upstash
โญ Star this repo if you find it helpful!
