This repository contains the backend of the Movie Recommendation System, powered by Flask. The API interacts with a recommendation model to provide movie suggestions based on content-based filtering.
The backend application serves as the recommendation engine for the movie platform, processing user requests and returning relevant recommendations based on content similarity. It leverages Flask to expose endpoints that interact with a Supabase database and utilize cosine similarity calculations for recommendations.
- Content-Based Filtering: Uses cosine similarity to recommend movies based on user preferences.
- Efficient Data Processing: Preprocessed movie data, enriched with TMDB metadata.
- Modular SOA Design: Integrates seamlessly with frontend and database services.
- Framework: Flask for handling REST API requests
- Database: Supabase (PostgreSQL instance) for user and movie data storage
- Modeling and Recommendations: Cosine similarity calculations with Scikit-Learn
- Deployment: Hosted on Microsoft Azure for scalability and reliability
-
Clone the repository:
git clone https://github.com/yourusername/backend-movie-recommendation.git cd backend-movie-recommendation -
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile with necessary environment variables:FLASK_APP=app.py FLASK_ENV=development SUPABASE_URL=your_supabase_url SUPABASE_ANON_KEY=your_supabase_anon_key AZURE_STORAGE_CONNECTION_STRING=your_azure_storage_connection_string -
Run the Flask server:
flask run
-
GET
/recommend: Accepts a POST request with a JSON payload containing the movie title. Returns a list of recommended movies.Example Request:
{ "title": "Inception" }Example Response:
{ "recommendations": ["The Matrix", "Interstellar", "Shutter Island"] }
app.py: Main file to start the Flask app and define endpoints.utils/: Utility functions, including data processing and similarity calculation.models/: Contains model files for recommendation calculations.artifacts/: Stores precomputed similarity matrices and other data artifacts.
- GitHub Actions Workflow: Automate deployment to Azure Web App.
- Configuration: Modify
.envandrequirements.txtas needed for your Azure environment. - Azure Setup: Upload code to Azure and run the API on a web server like Gunicorn.