File size: 2,115 Bytes
b75b093
 
 
 
 
 
37fec54
b75b093
 
 
 
a1a5ffc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: Recommendation LLM Explainer
emoji: 🎬
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 6.3.0
app_file: app.py
pinned: false
---

# AI-Powered Explainable Recommendations

This project is a high-fidelity demonstration of how Large Language Models (LLMs) can bridge the "explainability gap" in recommendation systems. It transforms opaque collaborative filtering data into transparent, persona-aligned narratives.

![Demo Application](home-page-recos.jpg)

## πŸš€ Overview

Instead of providing a "black box" list of suggestions, this system uses LLMs to synthesize natural language explanations based on user personas and collaborative filtering logic.

### Key Features
- **Specialist Centroids**: Personas built by aggregating top "specialists" for specific genres.
- **Layered Re-ranking**: Incorporates Genre Affinity Boosts and Recency Bias.
- **Narrative Synthesis**: Uses LiteLLM to generate 3-sentence explanations in "Logic-Driven" or "Social-Behavioral" styles.

## πŸ›  Tech Stack

- **Interface**: [Gradio](https://gradio.app/)
- **Recommendation Engine**: Python (`pandas`, `numpy`, `scikit-learn`)
- **LLM Integration**: [LiteLLM](https://github.com/BerriAI/litellm)
- **Data Source**: [MovieLens Latest Small](https://grouplens.org/datasets/movielens/latest/)
- **Visuals**: [TMDB API](https://www.themoviedb.org/documentation/api) for movie posters.

## πŸ“ Quick Start

1.  **Environment Setup**:
    Create a `.env` file:
    ```env
    HF_TOKEN=your_huggingface_token
    TMDB_API_KEY=your_tmdb_api_key
    ```
2.  **Install Dependencies**:
    ```bash
    pip install -r requirements.txt
    ```
3.  **Data Preparation**:
    ```bash
    python data_prep.py
    ```
4.  **Run the Application**:
    ```bash
    python app.py
    ```

## πŸ“œ Acknowledgments & Data Sources

- **Dataset**: This project uses the **MovieLens Latest Dataset - Small** provided by [GroupLens Research](https://grouplens.org/datasets/movielens/).
- **Images**: Movie posters are retrieved using the **TMDB API**. *Note: This product uses the TMDB API but is not endorsed or certified by TMDB.*