Ascendrix/NLP
0
๐ฌ 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
Pipeline per query:
- Encode user query โ 384-dim embedding
- FAISS nearest-neighbour search (k=3)
- Format retrieved movies + conversation history as context
- Gemini generates a conversational, explained recommendation
Setup (first-time / local)
1. Clone and install
git clone https://huggingface.co/spaces/<your-username>/moviemate
cd moviemate
pip install -r requirements.txt2. Set environment variables
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/api3. (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:
python scripts/fetch_dataset.py4. Run locally
python app.pyHugging Face Spaces deployment
Secrets (required)
In your Space โ Settings โ Repository secrets, add:
Committing the dataset (recommended)
Committing movies_updated.csv to the repo avoids the TMDB fetch on every cold start:
git lfs install # HF uses LFS for large files automatically
git add movies_updated.csv
git commit -m "add pre-fetched dataset"
git pushFile 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.csvis 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-cpuis used for HF compatibility. Search over 1 000 movies is near-instant.
