How to deploy a machine learning model as a REST endpoint


I will be developing a series of machine learning models that I would like to then deploy via a REST endpoint for a service.

I am fairly new to the Julia community so I currently don’t have knowledge of the recommended packages and approaches to completing this task.

Would it be possible for someone to provide suggestions on the best way to go or best packages/tools to use to accomplish this task.

Ideally I’d like to use Docker so ultimately I would need to do the following.

  1. Create REST API project
  2. Within the project the endpoints will be mapped to a machine learning model.
  3. Deploy the application using Docker Julia
  4. Setup nginx to map to that docker endpoint.

You have two reasonable options:

  • building the endpoint from scratch using Sockets API (it’s easy in Julia)
  • using JuliaWebAPI.jl and ZMQ.jl packages (more configuration but more robust)

Using ZMQ you can run something like register(apir, my_function_name; resp_json=true, resp_headers=Dict("Content-Type" => "application/json; charset=utf-8")) to publish any Julia function.
Normally, you put JuliaWebAPI as a frontend to your RESTful functions and you can configure nginx to point to that service.

Yet another, third, option is to look at Genie.jl package.

Hope that helps.

1 Like

Thank you for your response.
I will take a look at each of these.

@rwatts3 any experience or solution concept sharing? Thx.

Some time has passed since I last worked on that particular problem, but if I recall correctly I ended up using the Genie Framework

1 Like