Research Prototype for Academic Use
Developed by Dilli Ram Chaudhary
MindMetrics AI is a FastAPI-based machine learning REST API that predicts a student's Mental Health Score based on demographic information, academic lifestyle, social media usage, and daily habits.
The project is designed as an academic research prototype to demonstrate the deployment of a trained machine learning model using FastAPI, Pydantic, and Joblib.
Disclaimer: Predictions generated by this model are statistical estimates and must not be considered medical, psychological, or clinical advice.
- FastAPI REST API
- Machine Learning Model Prediction
- Input Validation using Pydantic
- Country Grouping for unseen countries
- Type-safe API
- Ready for deployment
- Automatic Swagger Documentation
- High-performance inference
- Python
- FastAPI
- Pydantic
- Pandas
- NumPy
- Joblib
- Uvicorn
- HTML
- CSS
- JS
MindMetrics-AI/
│
├── data/
| └── Student Social Media And Mental Health Impact.csv
├── model/
│ └── Mental_Health_model.pkl
├── index.html
├── main.py
├── requirements.txt
├── README.md
└── .gitignore
git clone https://github.com/dilliram-code/mentis.gitcd mentispython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtuvicorn main:app --reloadIf your file has another name, replace main with your filename.
Example:
uvicorn app:app --reloadAfter starting the server:
Swagger UI
http://127.0.0.1:8000/docs
ReDoc
http://127.0.0.1:8000/redoc
Returns a welcome message.
{
"Hello to mental score checker"
}Predicts the Mental Health Score.
{
"age": 21,
"gender": "Male",
"country": "India",
"academic_level": "Undergraduate",
"most_used_platform": "Instagram",
"purpose_of_use": "Entertainment",
"average_daily_usage_hours": 5.4,
"daily_unlocks": 120,
"study_hours": 3,
"physical_activity_hours": 1.5,
"sleep_hours_per_night": 7,
"stress_level": "Medium"
}{
"predicted_mental_health_score": 4.82
}docker pull dilliramchaudhary/mental-health-api:latestdocker run -p 8000:8000 dilliramchaudhary/mental-health-api:latesthttp://localhost:8000/docs
docker build -t mental-health-api .docker tag mental-health-api:latest dilliramchaudhary/mental-health-api:latestdocker push dilliramchaudhary/mental-health-api:latest| Feature | Type | Description |
|---|---|---|
| age | Float | Student's age |
| gender | String | Male or Female |
| country | String | Country name |
| academic_level | String | Undergraduate, Graduate, High School |
| most_used_platform | String | Primary social media platform |
| purpose_of_use | String | Education, Entertainment, Networking, News |
| average_daily_usage_hours | Float | Average hours spent daily |
| daily_unlocks | Integer | Number of phone unlocks per day |
| study_hours | Float | Study hours per day |
| physical_activity_hours | Float | Physical activity hours per day |
| sleep_hours_per_night | Float | Average sleep duration |
| stress_level | String | Low, Medium, High, Very High |
The model groups countries into predefined categories.
Supported countries include:
- India
- USA
- Canada
- Australia
- UK
- Germany
- Mexico
- Turkey
- France
Any country outside this list is automatically categorized as Other.
The API returns a predicted mental health score.
{
"predicted_mental_health_score": 4.82
}10 - 100
0 - 24
0 - 24
0 - 24
0 - 24
0+
curl -X POST "http://127.0.0.1:8000/predict" \
-H "Content-Type: application/json" \
-d '{
"age":21,
"gender":"Male",
"country":"India",
"academic_level":"Undergraduate",
"most_used_platform":"Instagram",
"purpose_of_use":"Entertainment",
"average_daily_usage_hours":5.5,
"daily_unlocks":130,
"study_hours":4,
"physical_activity_hours":1,
"sleep_hours_per_night":7,
"stress_level":"Medium"
}'The API loads a pre-trained machine learning model using Joblib.
model = joblib.load("model/Mental_Health_model.pkl")The model predicts a continuous Mental Health Score from the supplied input features.
This project is intended solely for:
- Academic research
- Educational purposes
- Machine learning demonstrations
- API deployment practice
The predicted score does not represent a medical diagnosis and should never replace professional mental health evaluation or treatment.
Dilli Ram Chaudhary
AI Research scholar | Aspiring Learning Engineer | Data Science Enthusiast
If you found this project useful, consider giving it a ⭐ on GitHub to support the project.