Giter Club home page Giter Club logo

cartoonize-ajdust_dependencies's Introduction

Cartoonizer

Convert images and videos into a cartoon!

The webapp is deployed here - https://cartoonize-lkqov62dia-de.a.run.app

Powered by Algorithmia

You can find a writeup on this webapp's architecture here!


Contents


Prerequisites for Google Cloud and Algorithmia

These are important steps if you want to leverage Google buckets, signed URLs and Algorithmia's platform. Skip this if you want to run locally / colab.

Cloud Run authentication

To use any functionalities pertaining to Google Cloud, you'll need a global authentication file (JSON). You can obtain this JSON by following the steps given here - Getting started with authentication

After you get the JSON file, rename it to token.json (so that it's compatible with the codebase).

Set the environment variable in your terminal -

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/token.json"

Notes:

  • You can set it permanently by adding this line to ~/.bashrc.
  • Dockerfile already includes the setting of this particular environment variable. :)

Algorithmia

We used the Serveless AI Layer product of Algorithmia for inference on videos. To learn more on how to deploy your model in Algorithmia, check here - https://algorithmia.com/developers


Installation

Application tested on:

  • python 3.7
  • tensorflow 2.1.0
  • tf_slim 1.1.0
  • ffmpeg 3.4.8
  • Cuda version 10.1
  • OS: Linux (Ubuntu 18.04)

Using Docker

The easiest way to get the webapp running is by using the Dockerfile:

  1. cd into the root directory and build the image
docker build -t cartoonize .

Note: Set the appropriate values in config.yaml before building the image.

  1. Run the container by exposing the appropriate ports
docker run -p 8080:8080 cartoonize

Using virtualenv

  1. Make a virtual environment using virutalenv and activate it
virtualenv -p python3 cartoonize
source cartoonize/bin/activate
  1. Install python dependencies
pip install -r requirements.txt
  1. Run the webapp. Be sure to set the appropriate values in config.yaml file before running the application.
python app.py
  1. Clone the repository using either of the below mentioned way:
    • Using Command:

      • Create a new Notebook in Colab and in the cell execute the below command.
       ! git clone https://github.com/experience-ml/cartoonize.git
      

      Note: Don't forget to add ! at the beginning of the command

    • From Colab User Interface

       Open Colab
           └── File
                └── Open Notebook
                         └── Github
                               └── paste the Url of the repository

Note : Before running the application change the runtime to GPU for processing videos but you for images CPU shall also work just fine.

           Runtime
              └── Change runtime type
                          └── Select GPU
  1. After cloning the repository navigate to the /cartoonize using below command in the notebook cell:

    %cd cartoonize
    
  2. Run the below commands in the notebook cell to install the requirements.

    !pip install -r requirements.txt
    
  3. In config.yaml file set:

    colab-mode: true 
    
  4. Launch the flask app on ngrok

    !python app.py
    

Note : Sample Google Colab Notebook for reference


Sample Image and Video

Emma Watson Cartoonized

Emma Watson Cartoonized

Youtube Video of Avenger's Bar Scene Cartoonized

Cartoonized version of Avenger's bar scene


License

  1. Copyright © Cartoonizer (Demo webapp)

  2. Copyright (C) Xinrui Wang, Jinze Yu. (White box cartoonization)

cartoonize-ajdust_dependencies's People

Contributors

nirajpandkar avatar tjdevworks avatar abhijitjadhav1998 avatar ghost---shadow avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.