| title | RevenueShield Telecom AI |
|---|---|
| emoji | π‘ |
| colorFrom | blue |
| colorTo | indigo |
| sdk | docker |
| app_port | 7860 |
| pinned | false |
| license | mit |
Real-time customer churn risk scoring β serving Random Forest via FastAPI on Hugging Face Spaces.
Submit 19 customer attributes β demographics, service subscriptions, billing details β and the model returns an instant STAY / CHURN decision with:
- Churn probability as a percentage
- A High / Medium / Low risk classification
- An animated risk gauge and dual probability bars
- Server-side inference latency in milliseconds
- Real-Time Inference β Sub-15ms predictions via a FastAPI + Uvicorn backend
- Animated Risk Gauge β SVG arc gauge fills dynamically with color-coded risk levels
- 19-Feature Model β Covers demographics, contracts, internet services, billing, and add-ons
- Pydantic Validation β All 19 input fields are strictly type-checked before reaching the model
- Request Log β Live terminal-style log panel shows every request, RTT, and risk level
- Keep-Alive Endpoint β
/pingprevents Render free-tier cold starts when monitored by UptimeRobot - Full API Docs β Auto-generated Swagger UI at
/docsand ReDoc at/redoc - Responsive UI β Works on mobile, tablet, and desktop
| Layer | Technology |
|---|---|
| Machine Learning | Python, Pandas, NumPy, Scikit-Learn, Random Forest |
| Hyperparameter Tuning | GridSearchCV / RandomizedSearchCV |
| Backend API | FastAPI, Uvicorn, Pydantic |
| Frontend | HTML5, CSS3, Vanilla JavaScript |
| Deployment | Render (API) + GitHub Pages (Frontend) |
Telecom-AI-Predictor/
β
βββ main.py # FastAPI backend server
βββ index.html # Frontend dashboard
βββ End-to-End ML Pipeline for Customer Churn Predict.ipynb # Training notebook
βββ requirements.txt # Python dependencies
βββ LICENSE.txt # MIT License
βββ .gitignore # Git ignore rules
βββ README.md # Project documentation
β
βββ model.pkl # (gitignored β not committed)
- Python 3.10 or higher
git clone https://github.com/nilotpaldhar2004/Telecom-AI-Predictor.git
cd Telecom-AI-Predictorpython -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtPlace model.pkl in the project root (same folder as main.py).
Don't have the model? Run the Jupyter notebook
End-to-End ML Pipeline for Customer Churn Predict.ipynbfrom start to finish β it trains and savesmodel.pklautomatically.
python main.pyOpen http://localhost:8000 in your browser β FastAPI serves index.html directly.
| Component | Host | URL |
|---|---|---|
Frontend (index.html) |
GitHub Pages | https://nilotpaldhar2004.github.io/Telecom-AI-Predictor/ |
Backend (main.py) |
Render | https://telecom-ai-predictor.onrender.com |
- Push your code to GitHub (
model.pklis gitignored β add it via Render Disk or environment) - Go to render.com β New Web Service β connect your repo
- Start Command:
uvicorn main:app --host 0.0.0.0 --port $PORT - Environment: Python 3
- Deploy β Render gives you a public URL
Tip: Create a free UptimeRobot monitor pointing at
https://your-app.onrender.com/pingevery 10 minutes to keep the server warm and avoid cold-start delays.
- Settings β Pages β Source β main branch β / (root)
- Save β GitHub Pages serves
index.htmlautomatically within ~60 seconds
{
"status": "ok",
"model_loaded": true,
"version": "2.0.0"
}{ "pong": true }Request body (19 fields):
{
"gender": "Male",
"SeniorCitizen": 0,
"Partner": "Yes",
"Dependents": "No",
"tenure": 12,
"PhoneService": "Yes",
"MultipleLines": "No",
"InternetService": "Fiber optic",
"OnlineSecurity": "No",
"OnlineBackup": "No",
"DeviceProtection": "No",
"TechSupport": "No",
"StreamingTV": "No",
"StreamingMovies": "No",
"Contract": "Month-to-month",
"PaperlessBilling": "Yes",
"PaymentMethod": "Electronic check",
"MonthlyCharges": 70.35,
"TotalCharges": 844.20
}Response:
{
"prediction": 1,
"probability": 74.81,
"risk_level": "High",
"result": "Customer Will Churn",
"latency_ms": 8.23
}Full interactive documentation is available at /docs (Swagger UI) when the server is running.
| Property | Value |
|---|---|
| Algorithm | Random Forest Classifier |
| Training Dataset | IBM Telco Customer Churn |
| Input Features | 19 |
| Risk Thresholds | High > 70% Β· Medium 30β70% Β· Low < 30% |
| Output | Binary (0 = Stay, 1 = Churn) + probability |
This project is licensed under the MIT License. See LICENSE.txt for details.
Nilotpal Dhar Β· @nilotpaldhar2004 Β· March 2026