vankesteren / fastapi_film_recommender

Small proof-of-concept of API-based recommendation system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Film rental recommender

This repository implements a recommender system microservice on top of an example database of film rentals. The recommender is accessible as an API via the browser.

The recommender is a basic collaborative filtering method based on latent semantic analysis - a truncated singular value decomposition of a TFiDF transformed customer-rental matrix.

Note that the results are nonsensical because the data is just an example database, but the method should in principle work!

Tech stack πŸ—οΈ

  • 🐘 PostgreSQL, with example database from xzilla/pagila; see also the schema
  • πŸ»β€β„οΈ polars for running queries and dataframe operations
  • πŸ“ˆ scikit-learn for creating a simple product recommender
  • ⚑ FastAPI for turning this into a microservice
  • πŸ‹ Docker for containerizing the whole application

Installation πŸ“¦

  1. Install docker
  2. Clone this repository
  3. Run docker compose up
  4. Navigate to localhost:8000/recommend/1?n=5 or see the docs at localhost:8000/docs

For different installation methods and development, see here.

Structure

The repo is structured as follows:

Why did I make this?

I wanted to try out FastAPI and Docker, and for me having a specific project is always the best motivation to learn new stuff -- even if it's just a toy project!

About

Small proof-of-concept of API-based recommendation system

License:MIT License


Languages

Language:Python 85.8%Language:HTML 6.1%Language:Dockerfile 5.2%Language:CSS 2.9%