Ask in plain English. Get intelligent movie recommendations powered by TF-IDF content analysis and Neo4j graph relationships.
CineGraph-AI is an AI-powered movie recommendation system that combines content-based filtering and graph-based relationship analysis to provide intelligent and explainable movie recommendations.
The system uses:
- TF-IDF + Cosine Similarity for content-based recommendations
- Neo4j Graph Database for relationship-based recommendations
- Groq LLaMA 3.3 for natural language understanding and recommendation explanations
- MongoDB Atlas for query logging and history tracking
- FastAPI for backend APIs
- Streamlit for an interactive user interface
Users can simply ask movie-related questions in natural language and receive relevant recommendations with AI-generated explanations.
User Query (Natural Language)
β
βΌ
Groq AI Router
(Intent Classification)
β
ββββββββ΄βββββββ
βΌ βΌ
TF-IDF Engine Neo4j Graph Engine
(Content-Based) (Relationship-Based)
β β
ββββββββ¬βββββββ
βΌ
Hybrid Recommendations
βΌ
Groq Explanation
βΌ
Streamlit UI
Movies are converted into text representations using:
- Overview
- Genres
- Cast
- Keywords
TF-IDF vectorization and Cosine Similarity are then used to identify movies with similar content.
Neo4j stores movies and their relationships:
(Actor)-[:ACTED_IN]->(Movie)
(Director)-[:DIRECTED]->(Movie)
(Movie)-[:IN_GENRE]->(Genre)This enables discovery through shared actors, directors, and genres.
Groq LLaMA 3.3 analyzes user intent and determines whether to use:
- TF-IDF recommendation engine
- Neo4j graph engine
- Hybrid recommendation engine
The model also explains recommendations in natural language.
- Natural language movie search
- Content-based recommendations using TF-IDF
- Graph-based recommendations using Neo4j
- Hybrid recommendation engine
- AI-generated recommendation explanations
- FastAPI REST API backend
- Interactive Streamlit frontend
- MongoDB Atlas search history logging
- Explainable recommendation workflow
- Scalable graph architecture
| Entity | Count |
|---|---|
| Movies | 4,800 |
| Actors | 5,683 |
| Directors | 2,574 |
| Genres | 20 |
| Relationships | 32,000+ |
- Movie
- Actor
- Director
- Genre
(Actor)-[:ACTED_IN]->(Movie)
(Director)-[:DIRECTED]->(Movie)
(Movie)-[:IN_GENRE]->(Genre)| Layer | Technology |
|---|---|
| Programming Language | Python |
| Frontend | Streamlit |
| Backend | FastAPI |
| Machine Learning | Scikit-Learn |
| Content Similarity | TF-IDF |
| Similarity Metric | Cosine Similarity |
| Graph Database | Neo4j |
| Query Language | Cypher |
| AI Model | Groq LLaMA 3.3 |
| Logging Database | MongoDB Atlas |
CineGraph-AI/
β
βββ Screenshots/
β βββ FastAPI-Swigger-UI.png
β βββ FastAPI-Swigger-UI-2.png
β βββ FastAPI-Swigger-UI-Input.png
β βββ Streamlit-Neo4j-test.png
β βββ Streamlit-TF-IDF-test.png
β
βββ data/
β βββ load_neo4j.py
β
βββ model/
β βββ preprocess.py
β βββ recommend.py
β βββ groq_router.py
β βββ utils.py
β
βββ api/
β βββ main.py
β
βββ app/
β βββ app.py
β
βββ .env
βββ requirements.txt
βββ README.md
git clone https://github.com/MohomedShajith/CineGraph-AI.git
cd CineGraph-AIpython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate a .env file:
GROQ_API_KEY=your_groq_api_key
MONGO_URI=your_mongodb_connection_string
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=your_neo4j_passwordOpen Neo4j Desktop and start the movie database.
python data/load_neo4j.pyuvicorn api.main:app --reloadSwagger Documentation:
http://localhost:8000/docs
streamlit run app/app.py| Method | Endpoint | Description |
|---|---|---|
| GET | /recommend/{movie_title} |
Hybrid recommendations |
| GET | /recommend/content/{movie_title} |
TF-IDF recommendations |
| POST | /query |
Execute custom Cypher query |
| GET | /history |
View MongoDB search history |
| GET | /health |
Application health check |
Recommend movies similar to Inception
Find movies directed by Christopher Nolan
Action movies starring Tom Cruise
Science fiction movies like Interstellar
Movies featuring Leonardo DiCaprio
- Collaborative Filtering Recommendations
- Movie Poster Integration
- Rating-Based Filtering
- Personalized User Profiles
- Graph Visualization Dashboard
- Docker Support
- Cloud Deployment
- Recommendation Feedback System
Mohomed Shajith
GitHub: https://github.com/MohomedShajith
If you found this project useful:
- Star the repository
- Fork the project
- Share feedback and suggestions
Built with β€οΈ using Python, Neo4j, FastAPI, Streamlit, MongoDB Atlas, and Groq AI.



