Spaces:
Sleeping
A newer version of the Gradio SDK is available:
5.43.1
title: DSA Project
emoji: π
colorFrom: pink
colorTo: purple
sdk: gradio
sdk_version: 5.25.2
app_file: app_gradio.py
pinned: false
short_description: Customer Churn Analysis and Prediction
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Customer Churn Prediction Application
This application predicts customer churn based on various customer attributes using a machine learning model.
Overview
Customer churn prediction is a critical task for businesses to identify customers who are likely to discontinue using their products or services. This application uses a Random Forest model trained on historical customer data to predict churn likelihood.
Features
- Interactive web interface for making churn predictions
- Input validation and error handling
- Visualization of model performance through ROC curve
- Probability-based risk assessment
- Easy-to-use sliders and dropdown menus for data input
Installation
Prerequisites
- Python 3.8 or higher
- Required packages (see requirements.txt)
Setup
To run this application on your local machine:
- Clone this Space
- Install the required packages:
pip install -r requirements.txt
- Run the application:
streamlit run app.py
Usage
Adjust the sliders and select options to input customer information:
- Age
- Gender
- Tenure (months)
- Usage Frequency
- Support Calls
- Payment Delay
- Last Interaction (days ago)
- Total Spend
- Subscription Type
- Contract Length
Click "Predict Churn" to see the prediction results.
The application will display:
- Churn prediction (Yes/No)
- Churn probability (0.00-1.00)
- Risk level (Low/Medium/High)
- ROC curve visualization showing model performance
Model Information
The prediction model (best_model.pkl
) is a trained Random Forest classifier that has been optimized for churn prediction. The model was trained on historical customer data with features including demographic information, usage patterns, and financial metrics.
Deployment
This application can be deployed on Hugging Face Spaces:
- Create a new Space on Hugging Face
- Select Streamlit or Gradio as the SDK
- Upload the necessary files:
app.py
(orapp_gradio.py
)best_model.pkl
roc_curve_rf_tuned.png
requirements.txt
Files Description
app.py
: Streamlit application codeapp_gradio.py
: Gradio application code (alternative interface)best_model.pkl
: Trained machine learning modelroc_curve_rf_tuned.png
: ROC curve visualization of model performancerequirements.txt
: List of Python dependencies