This is the personalized recommendation microservice for E-cercise, powered by FastAPI and Sentence Transformers.
- Equipment option recommendations based on:
- User goal, weight, height, gender, age
- Experience level (e.g. Beginner, Athlete)
- Tag-based preferences
- Embedding-based vector similarity with fallback scoring
- CORS-ready for frontend integration
- Fully containerized with Docker
.
├── api/ # FastAPI router
├── services/ # Recommendation logic
├── utils/ # Vector handling, text utils
├── models/ # Pydantic schema models
├── data/ # Precomputed vector cache + equipment options
├── generate_equipment_vector_cache.py # Precomputes vector cache
├── main.py # FastAPI entrypoint
├── config.py # Loads .env config
├── .env.example # Example config file
├── requirements.txt # Python dependencies
├── Dockerfile # Docker container setup
Copy .env.example
→ .env
and fill in your settings:
cp .env.example .env
docker build -t recommender .
docker run --env-file .env -p 8000:8000 recommender
python generate_equipment_vector_cache.py
POST /recommend
Content-Type: application/json
{
"goal": "weight-loss",
"experience": "beginner",
"gender": "female",
"age": 25,
"preferences": [
{ "tag": "glutes", "group": "muscle" }
]
}
Returns top 10 scored equipment options 🎯
uvicorn main:app --reload
MIT