A sophisticated book recommendation system that combines semantic search, emotion analysis, and AI embeddings to deliver personalized book suggestions based on user preferences and emotional tone.
- Semantic Search: Uses OpenAI embeddings for intelligent content understanding
- Emotion-Based Filtering: Recommends books based on desired emotional tone (Happy, Sad, Suspenseful, etc.)
- Multi-Modal Search: Supports natural language queries like "adventurous fantasy with strong characters"
- Category Filtering: Fiction, Non-fiction, Children's books
- Tone Selection: Happy, Surprising, Angry, Suspenseful, Sad
- Flexible Limits: Customizable result count (8-32 books)
- Real-time Search: Instant book search with autocomplete
- Hybrid Approach: Combines keyword matching with semantic understanding
- Rich Metadata: Displays ratings, categories, descriptions, and cover images
- Python 3.9+
- Node.js 16+
- OpenAI API Key
git clone https://github.com/Bagusdevaa/Book-Recommender.git
cd book-recommendercd backend
# Install dependencies
pip install -r requirements.txt
# Setup environment variables
cp .env.example .env
# Add your OPENAI_API_KEY to .env
# Run the server
uvicorn app.main:app --reloadBackend will be available at http://localhost:8000
cd frontend
# Install dependencies
npm install
# Start development server
npm run devFrontend will be available at http://localhost:5173
| Component | Technology | Purpose |
|---|---|---|
| AI Embeddings | OpenAI text-embedding-ada-002 | Semantic understanding |
| Vector Database | ChromaDB + LangChain | Similarity search |
| Emotions Classification | Hunggingface j-hartmann/emotion-english-distilroberta-base | Tones filtering |
| Categories Classification | Hunggingface facebook/bart-large-mnli | Categories filtering |
| Data Processing | Pandas + NumPy | Data manipulation |
| Backend | FastAPI + Uvicorn | REST API |
| Frontend | React + Vite | Modern UI development |
| Styling | Tailwind CSS | Responsive design |
- Size: 7,000 books with rich metadata
- Sources: Kaggle - 7k Books
Each book analyzed across 5 emotional dimensions:
- Joy (0.0-1.0): Happiness, hope, uplift
- Sadness (0.0-1.0): Melancholy, tragedy, loss
- Fear (0.0-1.0): Suspense, tension, thriller elements
- Anger (0.0-1.0): Conflict, rage, social issues
- Surprise (0.0-1.0): Plot twists, unexpected elements
- Model: OpenAI text-embedding-ada-002
- Storage: ChromaDB for efficient similarity search
- Persistence: Local vector database for cost optimization
- OpenAI for powerful embedding models
- LangChain for seamless AI integration
- FastAPI for excellent async API framework
- React & Tailwind for modern frontend development
- Book data sources: Google Books API, Open Library
This project is licensed under the MIT License - see the LICENSE file for details.