Simple Web Application for Data Science Demos

1 minute read

I’ve been playing around with data science algorithms for a while now. Recently, I watched a tutorial from Pierian Data on Udemy and created a content-based movie recommender. Then I went ahead and built a web application to showcase it.

In this post, I’ll share how you can serve a recommender system with cloud services. If you are also looking for a way to host your model, I hope this post helps you get there.

The application is live at http://recommendersystems.appspot.com/ and you can find the GitHub repository for this demo here.

The repo has a structure like this: alt You can keep your notebooks and data files under notebook folder. These files are not going to be deployed. Everything else is under recommender folder which will be deployed to Google App Engine.

Get a copy of Recommender-Systems repo

  • Go ahead and clone this repo your machine
    git clone https://github.com/pinarkaymaz6/Recommender-Systems.git
    

Run it locally

Running locally is not a mandatory step, but I highly recommend it. It’s easier to save and view your changes, since deployment to cloud takes a few minutes.

  • Create a virtual environment and install dependencies
    cd Recommender-Systems/recommender
    python3 -m venv FILENAME
    source FILENAME/bin/activate
    pip install -r requirements.txt
    
  • Start the app
    python3 main.py
    

    Now visit http://127.0.0.1:8080/ to view your application.

Deploy to Google App Engine

  • First you should create a project on Google Cloud dashboard if you don’t have one. You can follow the instructions here to create a project.
  • Install Google Cloud SDK. Here is the guide for macOS. Make sure you initialize the setups by running gcloud init.

  • Deploy application with your project ID
    gcloud app deploy app.yaml --project PROJECTID
    

Your application should be ready shortly on PROJECTID.appspot.com.