Discover your next favorite book using Semantic Search, Vector Embeddings, and Emotion-Aware Ranking.
NextLeaf is an AI-powered semantic book recommendation system that recommends books based on meaning rather than keywords.
The application uses BAAI/bge-small-en-v1.5 embeddings with ChromaDB to retrieve semantically similar books and then improves the results using emotion-aware ranking generated from book descriptions.
- 🔎 Semantic search using vector embeddings
- 📚 Content-based recommendations
- ❤️ Emotion-aware ranking
- 🗂️ Genre filtering
- ⭐ Rating filtering
- ⚡ ChromaDB vector database
- 🤖 Hugging Face Transformers
- 🎨 Interactive Gradio interface
- 📱 Responsive UI
User Query
│
▼
Gradio Interface
│
▼
BGE Embedding Model
│
▼
ChromaDB Vector Search
│
▼
Candidate Books
│
▼
Emotion-aware Re-ranking
│
▼
Recommended Books
- User enters a natural language query.
- The query is converted into an embedding.
- ChromaDB retrieves semantically similar books.
- Apply optional filters (Category, Mood, Rating).
- Emotion scores re-rank the retrieved books.
- Display the best recommendations.
| Category | Technology |
|---|---|
| Language | Python 3.12 |
| UI | Gradio |
| Framework | LangChain |
| Vector Database | ChromaDB |
| Embeddings | BAAI/bge-small-en-v1.5 |
| NLP | Hugging Face Transformers |
| Data Processing | Pandas |
NextLeaf/
├── app.py
├── create_chroma_db.py
├── README.md
├── requirements.txt
├── LICENSE
├── .gitignore
├── data/
│ ├── chroma_db/
│ ├── books_cleaned.csv
│ ├── books_with_categories.csv
│ ├── books_with_emotions.csv
│ └── tagged_description.txt
└── notebooks/
├── data-exploration.ipynb
├── sentiment-analysis.ipynb
├── text-classification.ipynb
└── vector-search.ipynb
git clone https://github.com/<your-username>/NextLeaf.git
cd NextLeaf
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# Windows
# .venv\Scripts\activate
pip install -r requirements.txt
python app.pyThis project uses the 7K Books with Metadata dataset from Kaggle.
The dataset includes:
- Book title
- Author
- Description
- ISBN
- Categories
- Average rating
- Thumbnail
Book descriptions are enriched using the j-hartmann/emotion-english-distilroberta-base model.
Instead of matching exact words, NextLeaf retrieves books with similar meaning using dense vector embeddings.
Example:
"A magical coming-of-age adventure with friendship and danger"
Each book description is classified into:
- Joy
- Fear
- Sadness
- Anger
- Surprise
- Disgust
- Neutral
When a mood is selected, semantic similarity and emotion scores are combined to improve recommendation quality.
- User authentication
- Reading history
- Collaborative recommendations
- Hybrid BM25 + Vector Search
- LLM-generated summaries
- Docker support
- Cloud deployment
- LangChain
- Hugging Face
- ChromaDB
- Gradio
- Kaggle
Daksh Kadyan
B.Tech Computer Science & Engineering
Delhi Technological University (DTU)
If you found this project useful, consider giving the repository a ⭐ on GitHub.