puneet29 / stylizeapp

A flask website for style transfer
https://bit.ly/stylizeapp
GNU Lesser General Public License v3.0
35 stars 3 forks source link
computer-vision deeplearning flask machine-learning pytorch style styletransfer transfer

Style Transfer Website

A website that applies artistic styles to your photo. Based on the Artistic Style Transfer using Neural Networks. This project is an extension of Style transfer app

Live at bit.ly/stylizeapp

Hosted using AWS EC2, AWS S3, Gunicorn and Flask.

Architecture

AWS Architecture

Quick Start

Running locally

  1. Clone the repository

    git clone https://github.com/puneet29/stylizeapp.git
    cd stylizeapp
  2. Create new virtual environment

    • On windows:

      py -3 -m venv venv
    • On Linux:

      python3 -m venv venv
  3. Activate virtual environment

    • On windows:

      venv\Scripts\activate
    • On Linux:

      . venv/bin/activate
  4. Install all the dependencies

    pip3 install -r requirements
  5. Change the secret key in __init__.py at #19. Replace os.urandom(24) with actual bytes value.

  6. Run Web App

    gunicorn -w 4 -t 600 __init__:app

Running on server

Follow the same procedure, except 6th step. While running webapp we want the process to be daemonized, so that it runs in the background. For that:

We bind our application to all HTTP IPv4 addresses on the server using 0.0.0.0:80 and run 4 gunicorn processes that serve our application. The timeout for each gunicorn worker is set to 600 seconds, to account for 10 min delay during uploading process. -D option daemonizes the process.

Refer to this medium article on how I built this app. Also refer to this gist on how to setup an AWS EC2 instance.

Libraries used

References