Integrating Nx with Phoenix

Now that you have a running Phoenix application, you can start working toward integrating your semantic search machine learning model.

First, add the following dependencies to your mix.exs file:

 {​:bumblebee​, ​"​​~> 0.5"​},
 {​:nx​, ​"​​~> 0.7"​},
 {​:exla​, ​"​​>= 0.0.0"​},
 {​:explorer​, ​"​​~> 0.5"​}

For your application, you’ll need Bumblebee for loading pre-trained models, Nx for manipulating tensors and model serving, and EXLA for providing accelerated inference. You’ll also use Explorer for working with some CSV data to seed your database.

Next, run mix deps.get:

 mix deps.get

Then, create a new file book_search/model.ex. This file will contain the logic for loading, serving, and performing inference with ...

Get Machine Learning in Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.