| title | AI Book Recommender |
|---|---|
| emoji | 📚 |
| colorFrom | purple |
| colorTo | blue |
| sdk | docker |
| pinned | false |
| license | mit |
Discover your next favorite book with AI-powered recommendations based on semantic search and emotional tone analysis
Features • Installation • Usage • Technologies • Project Structure
- 🤖 AI-Powered Semantic Search - Uses OpenAI embeddings to understand the meaning behind your book preferences
- 🎭 Emotion-Based Filtering - Filter books by emotional tone (Happy, Sad, Angry, Suspenseful, Surprising)
- 📑 Category Filtering - Browse books by category for more targeted recommendations
- ⚡ Fast Vector Database - Persistent Chroma vector database for quick similarity searches
- 🎨 Beautiful UI - Modern, responsive Gradio interface with gradient themes
- 📊 Rich Book Metadata - Displays book covers, titles, authors, and descriptions
- Describe Your Ideal Book - Enter a natural language description of what you're looking for
- Filter by Preferences - Optionally select a category and emotional tone
- Get Personalized Recommendations - Receive 16 curated book suggestions with covers and descriptions
The system uses:
- Semantic Search: Converts book descriptions to vector embeddings for intelligent matching
- Emotion AI: Analyzes emotional content in book descriptions (joy, sadness, anger, fear, surprise)
- Hybrid Filtering: Combines semantic similarity with category and emotion filters
- Python 3.11 or higher
- OpenAI API key (Get one here)
-
Clone the repository
git clone https://github.com/yourusername/Book-recommender.git cd Book-recommender -
Create a virtual environment (recommended)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Create a
.envfile in the project root:OPENAI_API_KEY=your_api_key_here
-
Prepare the data
The first time you run the application, it will automatically create a vector database from the book descriptions. This may take a few minutes.
python gradio_dashboard.pyThe application will launch in your default web browser at http://127.0.0.1:7860
Try these example searches to get started:
- "A coming-of-age story about friendship and self-discovery" → Category: Fiction, Tone: Happy
- "A historical novel set during World War II" → Category: Nonfiction
- "An epic fantasy adventure with dragons and magic" → Category: Fiction, Tone: Surprising
- "A psychological thriller with unexpected twists" → Category: Fiction, Tone: Suspenseful
Explore the data cleaning and analysis process in the Jupyter notebook:
jupyter notebook data-exploration.ipynb| Technology | Purpose |
|---|---|
| Python 3.11+ | Core programming language |
| Gradio | Interactive web UI framework |
| LangChain | Framework for building LLM applications |
| OpenAI Embeddings | Text vectorization for semantic search |
| Chroma | Vector database for efficient similarity search |
| Transformers (Hugging Face) | Emotion analysis on book descriptions |
| Pandas & NumPy | Data manipulation and analysis |
| Matplotlib & Seaborn | Data visualization |
Book-recommender/
│
├── gradio_dashboard.py # Main Gradio application
├── data-exploration.ipynb # Data cleaning & EDA notebook
├── requirements.txt # Python dependencies
│
├── books_final.csv # Cleaned book dataset
├── tagged_descriptions.text # Book descriptions for embeddings
│
├── chroma_db/ # Persistent vector database (auto-generated)
└── .env # Environment variables (not tracked)
The project uses a curated dataset of books containing:
- ISBN-13 - Unique book identifier
- Title - Book title
- Authors - Author(s) name(s)
- Description - Book synopsis/summary
- Categories - Book genre/category
- Thumbnails - Cover image URLs
- Emotion Scores - Joy, sadness, anger, fear, surprise metrics
The system converts your natural language query into a vector embedding and finds books with similar meaning in their descriptions, even if they don't share the exact same words.
Each book description is analyzed for emotional content using transformer models, allowing you to find books that match your desired mood.
The Chroma database saves embeddings locally, so subsequent runs are much faster—no need to re-embed thousands of books each time!
Contributions are welcome! Here are some ways you can help:
- 🐛 Report bugs and issues
- 💡 Suggest new features
- 📝 Improve documentation
- 🔧 Submit pull requests
This project is licensed under the MIT License - see the LICENSE file for details.
- Book data sourced from Kaggle
- OpenAI for embeddings API
- Gradio team for the amazing UI framework
- Hugging Face for transformer models
Built with ❤️ by Zoro-chi
⭐ Star this repo if you found it helpful!