rebase ml API example

I rebase the ML API example. Welcome for advice!