Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 NextLeaf — AI Semantic Book Recommendation System

Discover your next favorite book using Semantic Search, Vector Embeddings, and Emotion-Aware Ranking.


📖 Overview

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.


✨ Features

  • 🔎 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

🏗️ System Architecture

User Query
     │
     ▼
Gradio Interface
     │
     ▼
BGE Embedding Model
     │
     ▼
ChromaDB Vector Search
     │
     ▼
Candidate Books
     │
     ▼
Emotion-aware Re-ranking
     │
     ▼
Recommended Books

🧠 Recommendation Pipeline

  1. User enters a natural language query.
  2. The query is converted into an embedding.
  3. ChromaDB retrieves semantically similar books.
  4. Apply optional filters (Category, Mood, Rating).
  5. Emotion scores re-rank the retrieved books.
  6. Display the best recommendations.

🛠️ Tech Stack

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

📂 Project Structure

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

⚙️ Installation

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.py

📚 Dataset

This 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.


🔍 Semantic Search

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"


❤️ Emotion-aware Ranking

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.


🚀 Future Improvements

  • User authentication
  • Reading history
  • Collaborative recommendations
  • Hybrid BM25 + Vector Search
  • LLM-generated summaries
  • Docker support
  • Cloud deployment

🙏 Acknowledgements

  • LangChain
  • Hugging Face
  • ChromaDB
  • Gradio
  • Kaggle

👨‍💻 Author

Daksh Kadyan

B.Tech Computer Science & Engineering
Delhi Technological University (DTU)


⭐ Support

If you found this project useful, consider giving the repository a ⭐ on GitHub.

About

AI-powered semantic book recommendation system using BGE embeddings, LangChain, ChromaDB, Hugging Face Transformers, and Gradio.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages