CoolFace
Apppublic

Ascendrix/NLP

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes
App README

๐ŸŽฌ MovieMate โ€” Conversational AI Movie Assistant

Exploring Conversational AI for Intelligent Movie Search and Recommendations NLP Assignment โ€” Hugging Face Spaces Deployment

What it does

MovieMate lets you discover movies through natural conversation instead of rigid keyword search. Ask in plain English โ€” it retrieves semantically similar films and explains its recommendations.

Example queries

  • โ€”"Recommend a sci-fi movie like Inception"
  • โ€”"Movies starring Leonardo DiCaprio after 2010"
  • โ€”"Best feel-good films for a Friday night"
  • โ€”"Who directed Interstellar?"

Architecture

LayerTechnology
DatasetTMDB API โ€” ~1 000 movies with genres, cast, director
Embeddingsall-MiniLM-L6-v2 (SentenceTransformers)
Vector searchFAISS IndexFlatL2
Response generationGemini 1.5 Flash
UIGradio 4 Blocks

Pipeline per query:

  1. 1.Encode user query โ†’ 384-dim embedding
  2. 2.FAISS nearest-neighbour search (k=3)
  3. 3.Format retrieved movies + conversation history as context
  4. 4.Gemini generates a conversational, explained recommendation

Setup (first-time / local)

1. Clone and install

bash
git clone https://huggingface.co/spaces/<your-username>/moviemate
cd moviemate
pip install -r requirements.txt

2. Set environment variables

bash
export GEMINI_API_KEY="your-gemini-key"   # from https://aistudio.google.com
export TMDB_API_KEY="your-tmdb-key"       # from https://www.themoviedb.org/settings/api

3. (Optional) Pre-fetch the dataset

If movies_updated.csv is absent the app fetches it automatically on first launch (takes ~5 min). To pre-generate and commit it:

bash
python scripts/fetch_dataset.py

4. Run locally

bash
python app.py

Hugging Face Spaces deployment

Secrets (required)

In your Space โ†’ Settings โ†’ Repository secrets, add:

Secret nameValue
GEMINI_API_KEYYour Google Gemini API key
TMDB_API_KEYYour TMDB API key (only needed if CSV is absent)

Committing the dataset (recommended)

Committing movies_updated.csv to the repo avoids the TMDB fetch on every cold start:

bash
git lfs install           # HF uses LFS for large files automatically
git add movies_updated.csv
git commit -m "add pre-fetched dataset"
git push

File structure

moviemate-hf/
โ”œโ”€โ”€ app.py                  # Main application (Gradio + RAG pipeline)
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ README.md               # This file (also the HF Space card)
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ fetch_dataset.py    # Standalone script to pre-build movies_updated.csv
โ””โ”€โ”€ movies_updated.csv      # Pre-fetched dataset (commit this to avoid cold-start delay)

Notes

  • โ€”Cold start: If movies_updated.csv is absent, the app fetches ~1 000 movies from TMDB (โ‰ˆ5 min). Commit the CSV to avoid this.
  • โ€”Gemini quota: The free tier allows ~60 requests/min. The app retries up to 3 times with back-off.
  • โ€”FAISS on CPU: faiss-cpu is used for HF compatibility. Search over 1 000 movies is near-instant.