Skip to content

Asmaathabet/Book_Recommender_LLM

Repository files navigation

📚 AI-Powered Book Recommender System

An intelligent book recommendation system that combines Semantic Search, Large Language Models (LLMs), Text Classification, and Sentiment Analysis to recommend books based on natural language descriptions and emotional preferences.

Users can describe the type of book they are looking for, select a category and emotional tone, and receive personalized recommendations through an interactive Gradio dashboard.


🚀 Features

  • Semantic book search using vector embeddings
  • Natural language queries
  • Category-based filtering
  • Emotion-aware recommendations
  • Interactive web interface with Gradio
  • Book cover previews and descriptions
  • Vector database powered by ChromaDB

🛠️ Technologies Used

AI & Machine Learning

  • LangChain
  • Hugging Face Transformers
  • Sentence Transformers
  • OpenAI API (optional)
  • Chroma Vector Database

Data Processing

  • Pandas
  • NumPy

Visualization & UI

  • Gradio
  • Matplotlib
  • Seaborn

Development

  • Python 3.11
  • Jupyter Notebook
  • python-dotenv

📂 Project Workflow

1. Data Preparation

  • Load and clean book metadata.
  • Extract and preprocess book descriptions.
  • Create structured text documents for vectorization.

2. Semantic Vector Search

  • Generate embeddings for book descriptions.
  • Store embeddings in a Chroma vector database.
  • Retrieve semantically similar books based on user queries.

3. Text Classification

  • Classify books into simplified categories.
  • Create category mappings for filtering recommendations.

4. Sentiment Analysis

  • Analyze emotional characteristics of book descriptions.

  • Generate emotion scores such as:

    • Joy 😊
    • Sadness 😢
    • Fear 😨
    • Anger 😠
    • Surprise 😲

5. Recommendation Engine

  • Combine semantic similarity with category and emotion filters.
  • Rank and return the most relevant books.

6. Gradio Dashboard

  • User-friendly interface for interacting with the recommendation engine.
  • Display book covers, titles, authors, and summaries.

📊 Dataset

This project uses the 7K Books with Metadata dataset from Kaggle:

https://www.kaggle.com/datasets/dylanjcastillo/7k-books-with-metadata

Dataset includes:

  • ISBN
  • Title
  • Authors
  • Categories
  • Descriptions
  • Thumbnails
  • Publication information

📦 Dependencies

Python Version

  • Python 3.11

Main Packages

kagglehub==0.3.5
pandas==2.2.3
matplotlib==3.10.0
seaborn==0.13.2
python-dotenv==1.0.1

langchain-community==0.3.27
langchain-openai==0.3.28
langchain-chroma==0.2.5
langchain-huggingface

transformers==4.47.1
gradio==5.38.2

notebook
ipywidgets==8.1.5

Install dependencies:

pip install -r requirements.txt

▶️ Running the Project

Clone the Repository

git clone <repository-url>
cd Book-Recommender

Run the Application

python gradio-dashboard.py

The application will launch locally and open an interactive recommendation dashboard.


📸 Application Screenshots

Main Dashboard

Dashboard

Recommendation Results

Results

Emotion-Based Recommendations

Emotion Recommendations


🎯 Example Query

Input:

A story about forgiveness, friendship, and personal growth.

Filters:

  • Category: Fiction
  • Tone: Happy

Output:

A list of semantically similar books ranked according to the selected emotional tone and category.


📈 Future Improvements

  • Hybrid search (semantic + keyword)
  • Multi-language recommendations
  • User ratings and feedback loop
  • Fine-tuned embedding models
  • Deployment on Hugging Face Spaces
  • Recommendation explanations using LLMs

About

An AI-powered Book Recommender System powered by LLM, LangChain, ChromaDB, and Transformer models.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors