How arpitjain-coder/churnai works
This is a telecom customer-churn prediction application, with both a Streamlit interface and a FastAPI service. Users provide customer and account details; the application encodes the inputs, scales numeric fields, and returns a churn prediction and probability. The API also exposes prediction history, aggregate statistics, and model feature impacts, and logs predictions to Supabase when configured or local SQLite otherwise. Training scripts create the model artifacts from the supplied dataset. The README is empty; the API excerpt omits some initialization and frontend code, so no browser-to-API wiring is asserted.
Main entry points: index.py FastAPI Service · churn_model.pkl Churn Model · app.py Streamlit App · train_better_model.py Model Training
Components 13
User Interfaces
- Streamlit App
app.py - FastAPI Service
api/index.py - Served Frontend
index.html
Prediction Runtime
- Churn Model
churn_model.pkl - Feature Scaler
scaler (1).pkl
History And Insights
- Prediction History
api/index.py - Usage Statistics
api/index.py - Feature Impacts
api/index.py - Supabase
- Local SQLite
api/index.py
Model Training
- Churn Dataset
WA_Fn-UseC_-Telco-Customer-Churn.csv - Model Training
train_better_model.py
Other components
- Customer
Connections 17
- Customer → Streamlit App: enters details
app.py - Streamlit App → Feature Scaler: loads and applies
app.py - Streamlit App → Churn Model: loads and predicts
app.py - Customer → FastAPI Service: submits details
- FastAPI Service → Served Frontend: serves HTML
api/index.py - FastAPI Service → Feature Scaler: scales features
api/index.py - FastAPI Service → Churn Model: predicts churn
api/index.py - FastAPI Service → Supabase: logs predictions
api/index.py - FastAPI Service → Local SQLite: logs predictions
api/index.py - Prediction History → Supabase: reads history
api/index.py - Prediction History → Local SQLite: reads history
api/index.py - Usage Statistics → Supabase: reads records
api/index.py - Usage Statistics → Local SQLite: reads records
api/index.py - Feature Impacts → Churn Model: reads importances
api/index.py - Churn Dataset → Model Training: trains from
train_better_model.py - Model Training → Churn Model: saves model
train_better_model.py - Model Training → Feature Scaler: saves scaler
train_better_model.py