Skip to content

Semantic Book Recommender an NLP-powered book recommendation system that uses semantic search instead of traditional keyword matching.By leveraging embeddings from Hugging Face's sentence-transformers & vector similarity with FAISS,based on input—a mood, topic, summary or quote —it returns the most contextually relevant books via a Gradio interface

License

Notifications You must be signed in to change notification settings

BusraRafa/Semantic-Book-Recommender-llm

Repository files navigation

📚 Semantic Book Recommender

This is a semantic search–based book recommendation system that uses natural language processing to recommend books based on user input. Instead of relying on fixed keywords or categories, it understands the meaning behind your input using sentence embeddings.

🔍 How It Works

  • Uses sentence-transformers (Hugging Face) to generate semantic embeddings from book descriptions.
  • To create your own vector database, you’ll need a .env file in the root directory containing either your OpenAI API key or Hugging Face token.
  • Stores and searches embeddings using FAISS (Facebook AI Similarity Search).
  • A Gradio interface that allows users to enter a query and receive book recommendations.
  • Input can be anything — a topic, mood, summary, or even a quote — and you'll get the most semantically relevant books.

🧰 Tech Stack

  • Python
  • LangChain
  • Hugging Face Transformers
  • FAISS
  • Gradio
  • Pandas

🔐 Environment Setup (Replit & Gitpod Users)

To run this project on Replit or Gitpod:

  1. Copy the contents of .env.example into a new file named .env in the root directory.
  2. Paste your Hugging Face token or OpenAI API key

Run on Replit

Open in Gitpod

⚙️ Setup Instructions

1. Clone the Repository

git clone https://github.com/BusraRafa/Semantic-Book-Recommender.git
cd Semantic-Book-Recommender

2. Create a Virtual Environment (optional but recommended)

python -m venv myenv
source myenv/bin/activate  # For Linux/macOS
myenv\Scripts\activate     # For Windows

3. Install Dependencies

A requirements.txt file containing all the project dependencies is provided as part of this repo.

pip install -r requirements.txt

4. Run the Gradio App

python gradio-dashboard.py

Once launched, open the app in your browser at: 👉 http://127.0.0.1:7860

To create a public shareable link, edit gradio-dashboard.py and modify:

dashboard.launch(share=True)

About

Semantic Book Recommender an NLP-powered book recommendation system that uses semantic search instead of traditional keyword matching.By leveraging embeddings from Hugging Face's sentence-transformers & vector similarity with FAISS,based on input—a mood, topic, summary or quote —it returns the most contextually relevant books via a Gradio interface

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published