Skip to content

Lancasterg/cartoon-gan-flask-api

Repository files navigation

Flask CartoonGAN API Docker Image CI

An api for developing cartoon-style images with CartoonGAN (CVPR 2018), powered by TensorFlow 2.0. Deployed using Flask and Flask-RESTful.

Before and after

Setup

Clone the repository.

$ git clone https://github.com/Lancasterg/cartoon-gan-flask-api.git 

Install the requirements (cpu).

$ python -m virtualenv cartoon-gan-venv     // create a venv

$ source activate cartoon-gan-venv          // init venv

$ pip install -r requirements-server.txt    // install requirements for flask server

$ pip install -r requirements-cpu.txt       // install requirements for ml

API

Dev

Start the API in development mode.

$ python flask_api/app.py

Or run using Docker

$ bash docker-build-dev.sh
$ docker run -d -p 5000:5000 cartoon-gan-api:latest

Test the API.

$ bash shell_scripts/hit_api.sh 

Backend

Run the cartoonize.py command to test the GAN.

python cartoonize.py \
    --input_dir input_images \
    --output_dir output_images \
    --styles shinkai hayao \
    --comparison_view horizontal

Acknowledgements

  • Thanks to the author [Chen et al., CVPR18] who published this great work
  • Massive thank you to the authors of the tensorflow implementation of CartoonGan-tensorflow
  • CartoonGAN-Test-Pytorch-Torch where we extracted pretrained Pytorch model weights for TensorFlow usage

Releases

No releases published

Packages

No packages published