A machine learning-based web application that predicts whether a user is likely to show signs of phone addiction based on factors such as screen time, social media usage, gaming time, sleep, notifications, app usage, stress level, and academic/work impact.
The application is built with Python and Streamlit and provides an interactive interface for making predictions using a trained machine learning model.
Streamlit App: https://phone-addiction-prediction-zoyfchvnbnbqrzkje3fghy.streamlit.app/
- 📱 Predicts phone addiction using a trained ML model
- ⏱️ Uses daily and weekend screen-time information
- 📲 Considers social media usage and gaming hours
- 🔔 Considers notifications and app openings per day
- 😴 Includes sleep hours as an input
- 🧠 Considers stress level
- 🎓 Considers academic/work impact
- 👤 Includes age and gender
- 🌐 Interactive Streamlit web interface
- 🧪 Automated model testing with
pytest - ⚙️ Continuous Integration using GitHub Actions
- Python
- Pandas
- Scikit-learn
- Joblib
- Streamlit
- Pytest
- GitHub Actions
Phone-Addiction-Prediction/
│
├── .github/
│ └── workflows/
│ └── tests.yml
│
├── src/
│ └── addiction_model.pkl
│
├── tests/
│ └── test_model.py
│
├── app.py
├── requirements.txt
├── runtime.txt
├── .gitignore
└── README.md
The application collects information from the user through the Streamlit interface.
The inputs include:
- ID
- Age
- Daily screen time
- Social media hours
- Gaming hours
- Work/study hours
- Sleep hours
- Notifications per day
- App opens per day
- Weekend screen time
- Gender
- Stress level
- Academic/work impact
The collected information is converted into a Pandas DataFrame and passed to the trained machine learning model.
The model returns:
1 → Addiction detected
0 → No addiction detected
git clone https://github.com/KhushiB03/Phone-Addiction-Prediction.gitcd Phone-Addiction-Predictionpython -m venv venvvenv\Scripts\activatesource venv/bin/activatepip install -r requirements.txtstreamlit run app.pyThe application will open in your browser.
This project uses pytest for automated testing.
Run the tests locally with:
pytestThe tests verify that:
- The trained machine learning model can be loaded successfully.
- The model accepts the expected input format.
- The model produces a valid prediction (
0or1).
GitHub Actions is used for Continuous Integration (CI).
Whenever code is pushed to the main branch or a pull request targets main, GitHub Actions automatically:
- Checks out the repository.
- Sets up Python.
- Installs project dependencies.
- Runs the pytest test suite.
Workflow file:
.github/workflows/tests.yml
The workflow helps ensure that changes to the project do not break the existing model functionality.
The application displays one of two results:
📱 Addiction detected
✅ No addiction detected
- Add model performance metrics such as accuracy, precision, recall, and F1-score.
- Add more comprehensive input validation tests.
- Add additional machine learning models for comparison.
- Improve prediction explanations using model interpretability techniques.
- Add automated model performance testing.
- Add continuous deployment improvements.
- Add data visualization for user inputs and prediction-related patterns.
This application is a machine learning project intended for educational and research purposes. Its predictions should not be treated as a medical or clinical diagnosis.
Khushi Bhardwaj
Computer Science Engineering Student | Machine Learning Enthusiast