Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Painting style transfer on photos

We aim to quickly and easly make our own favorite pictures look like a famous painter production. Hence we provide an easy way to provide some style examples and our personal pictures. It's even possible to blend styles.

Core engine provide from and has been made by Somshubra Majumdar. We thank him cheerly for his great job.

Clever Grid

What is it ?

Clever Grid is a GPU as a Service platform allowing any developer or data scientist to train their Machine Learning models seamlessly. They only have to provide the necessary code. No tidious driver configuration and dependency management is involved except the code dependencies.

How it Works

Based on Clever Cloud, Clever Grid provides two running modes.

  1. Runner : Run a script just once. It can be used to train networks
  2. Web service : Build a Web service and put it in production

These instances are stateless !! It means that data stored on disk cannot be saved. You need to use an add-on like Cellar instead. Cellar is Clever Cloud's S3 API compatible object storage

These instances run the provided code.

Setup is done using environment variables. This is for example how you specify the starting script (in Bash or Python).

for further information, refer to

Painting style transfer on photos


We only need a file (which can also be a python file -> don't forget to change the starting env variable). Here's what we need to do:

  • First we get the data source from our Cellar source bucket. They are the pictures we want to apply style on
  • We get some painting we want to use as style source from Cellar
  • We run Somshubra Majumdar's awesome script with the needed arguments. (It can be adjusted for better results. Ref on Somshubra Majumdar's documentation)
  • We send the result back to our Cellar bucket

Needed Environment Variables:

  1. To manage storage:

  2. To manage Cellar add-on:


    These are automatically setup when an Addon is linked to an Application

We use three additional python files to get and send data in Cellar :,,


We provide some helpers python script based on .env file.

environment variables must be the same than in the Clever Grid application

Helper Usage :

python param

param is a destination folder where we get results from buckets

python param

param is the source folder where pictures to process are stored

python param

param is the style folder where painting style examples are stored

Quick Start :

You need the Clever Cloud CLI client. See:

If you do not have a Clever Cloud account, you can get on for free here:

Steps 5 to 8 are to help you send your data into a Cellar storage object.

  1. Login to your Clever Grid Account

    clever login
  2. Link to your python_ml runner application

    clever link <APP_ID>

    You need a strong enough instance of your application for this task. Use at least a size L

    You need to have a Python Runner application in (see the section : Create an application on Clever Grid)

    <APP_ID> can be find on the application overview page

  3. Add your clever grid application repository to your current git project :

    git remote add clever git+ssh://<YOUR_APP_ID>.git

    note the <YOUR_APP_ID> field

  4. Set the needed environment variables:

This example run with python 3.6

  • In the Environment Variables menu under our Application menu in the clever grid console


  • Whit the clever CLI (Command Line tools) :

    clever env set CC_MLPYTHON_START_SCRIPT ""
    clever env set CC_PYTHON_VERSION "3.6"
  1. (optional) install required packages:

    Needed for helpers scripts

    pip install boto filechunkio python-dotenv
  2. (optional) set up a .env file with the same environment variables than in the Clever Grid application

    this step allow you to use helpers python script to send your data to Cellar

  3. (optional) use helpers scripts to send your data to Cellar and uncomment the dedicated part in

    This part allow you to send your own data instead of the examples ones

    python picture_source_folder
    python style_source_folder
  4. (optional) commit changes in the file :

    git add
    git commit -m "update to use personal data"
  5. push the code to your application:

    git push clever

    clever is the remote Clever Grid git repository name

  6. Finally start your application with

    clever deploy

    for all restart, use clever restart instead of deploy

  7. Wait until the end (see logs into the console or in your terminal). Then get the result:

    python dest_folder

Create an application on Clever Grid

  1. login to
  2. choose your organisation
  3. create an application
  4. select the Python Runner and name it
  5. choose your instance size and the number of nodes needed

Issues and Limits

This is a quick usage demonstration of Clever Grid. It is not optimized and the usage of to many style source files and pictures to treat can raise an OOM (Out Of Memory) during the execution !