Project Overview
- Name: Book Recommender (semantic + emotion-aware)
- Description: A semantic book recommender that combines document embeddings and emotion signals to surface emotionally relevant book recommendations. The project includes a Gradio dashboard (
dashboard.py), data CSVs used for recommendations, and several Jupyter notebooks for exploration and modeling.
Key Files
dashboard.py: Gradio app that runs a semantic recommender using HuggingFace sentence embeddings and a Chroma vector DB.books_with_emotions.csv,books_with_categories.csv,cleaned_books.csv: Datasets used by the project.tagged_description.txt: Text data used to build the embedding index.- Notebooks:
data-exploration.ipynb,sentiment-analysis.ipynb,text-classification.ipynb,vector-search.ipynb— for EDA and model experiments.
Requirements
- Use the provided
requirements.txtto install Python dependencies:
python -m venv .venv
; .\.venv\Scripts\Activate.ps1
; pip install -r requirements.txt
Running the Dashboard
- Ensure the virtual environment is active (see above).
- If you rely on any environment variables, add them to a
.envfile in the repo root.dashboard.pycallsload_dotenv(). - Start the app:
python dashboard.py
The dashboard uses a HuggingFace sentence-transformer (sentence-transformers/all-MiniLM-L6-v2) to compute embeddings and builds a Chroma vector store from tagged_description.txt. The app loads books_with_emotions.csv to provide metadata and emotional signals.
Notebooks
- Use the notebooks for exploration and to reproduce preprocessing, sentiment analysis, and vector search experiments. They contain the data-cleaning and modeling steps used to generate the datasets.
Models Used
sentence-transformers/all-MiniLM-L6-v2— used viaHuggingFaceEmbeddings(LangChain) to compute sentence embeddings for semantic search and the Gradio dashboard (dashboard.pyandvector-search.ipynb).bhadresh-savani/distilbert-base-uncased-emotion— used withtransformers.pipeline("text-classification")insentiment-analysis.ipynbto infer emotions/sentiment from book descriptions.typeform/distilbert-base-uncased-mnli— used withtransformers.pipeline("zero-shot-classification")intext-classification.ipynbfor zero-shot topic/class labeling.
Datasets & Outputs
- The CSV files in the repo are the primary inputs for the dashboard.
tagged_description.txtis used to build the vector index.
Troubleshooting
- If you get import errors for any
langchain_*or community imports, verify package names on PyPI. The project imports community LangChain modules (e.g.,langchain_community,langchain_text_splitters,langchain_chroma); if an import fails, try installinglangchain-community,langchain-text-splitters, andchromadb. - If embedding downloads fail, ensure you have internet access or have the model cached with
sentence-transformers.