# How to deploy a machine learning model as a REST endpoint

**URL:** https://discourse.julialang.org/t/how-to-deploy-a-machine-learning-model-as-a-rest-endpoint/18638
**Category:** General Usage
**Tags:** question
**Created:** [December 13, 2018, 7:01pm UTC](https://discourse.julialang.org/t/how-to-deploy-a-machine-learning-model-as-a-rest-endpoint/18638 "2018-12-13T19:01:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rwatts3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rwatts3/32/3776_2.png) [@rwatts3](https://discourse.julialang.org/u/rwatts3)
#### Post date: [December 13, 2018, 7:01pm UTC](https://discourse.julialang.org/t/how-to-deploy-a-machine-learning-model-as-a-rest-endpoint/18638/1 "2018-12-13T19:01:53Z")

</div>

Greetings,

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.

---

<div class="post-metadata">

### Author: ![pszufe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pszufe/32/23452_2.png) [@pszufe](https://discourse.julialang.org/u/pszufe)
#### Post date: [December 14, 2018, 12:22am UTC](https://discourse.julialang.org/t/how-to-deploy-a-machine-learning-model-as-a-rest-endpoint/18638/2 "2018-12-14T00:22:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![rwatts3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rwatts3/32/3776_2.png) [@rwatts3](https://discourse.julialang.org/u/rwatts3)
#### Post date: [December 14, 2018, 11:04pm UTC](https://discourse.julialang.org/t/how-to-deploy-a-machine-learning-model-as-a-rest-endpoint/18638/3 "2018-12-14T23:04:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Martin\_Florek](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)
#### Post date: [October 29, 2020, 6:46pm UTC](https://discourse.julialang.org/t/how-to-deploy-a-machine-learning-model-as-a-rest-endpoint/18638/4 "2020-10-29T18:46:09Z")

</div>

@rwatts3 any experience or solution concept sharing? Thx.

---

<div class="post-metadata">

### Author: ![rwatts3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rwatts3/32/3776_2.png) [@rwatts3](https://discourse.julialang.org/u/rwatts3)
#### Post date: [October 29, 2020, 8:51pm UTC](https://discourse.julialang.org/t/how-to-deploy-a-machine-learning-model-as-a-rest-endpoint/18638/5 "2020-10-29T20:51:16Z")

</div>

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

> **[Genie Framework - Productive Web Development With Julia](https://genieframework.com/)**
>
> Genie is a productive web development framework in Julia. Build web applications, UIs, backends, integrate with databases, set up web services and APIs.
