Titan Tutorial #1: Hello World!
In this first tutorial, we will explain how to deploy the simplest imaginable Jupyter Notebook to illustrate how easy is to transform models into services using Titan, our flagship product at Akoios. Let’s get started!
Now, we are ready to write a very simple Python code in one of the notebook cells (no imports needed!):
The code in the cell just prints “Hello world!” when executed. Imagine now that you want to make this available as a service using a REST API interface.
Here is where Titan comes into play. Instrumentalizing a notebook with Titan is as easy as following these steps:
- Select the HTTP method for the service (GET, PUT, POST, DELETE)
- Define an arbitrary name for the endpoint
To define this it is just needed to write at the top of the cell we want to be executed every time the endpoints is called. To make it understandable for Titan, this information must be written after the comment character in Python.
In this cell, we are telling Titan the following:
Execute everything in this cell every time someone makes a GET request to the /hello endpoint
Pretty simple, right?
Now that our “model” is ready, we can use Titan to transform it into a service. It’s as simple as running the command:
$ titan deploy
What we just did? When running $titan deploy this is what happens:
- Titan shows you all the notebook files (*.ipynb) located in the current folder
- You are requested to select one (helloworld.ipynb in our case)
- Then, you are requested to select the desired runtime environment, we used the scipy for this simple example.
That’s all. Here’s where Titan starts doing its magic:
- Build the project
- Deploy the model
- Start the service
By the end of the execution of the command, you will have a ready-to-use REST API endpoint located at a location like this:
In order for an API to make sense, it must be easily accessed and well documented. In that sense, Titan includes a Swagger UI interface at that URL with relevant information about the API and the model. Swagger UI also allows to interact with the API’s resources:
You can even make a call to the endpoint clicking on the “Try it out” button!
After trying and, as expected, this is what you will get from the API call:
Let’s now try to consume the service from an external application like Postman. For an easy call like this one, it is just required to provide the following information:
- HTTP method: GET
- Endpoint: https://services.demo.akoios.com/helloworld/hello
In case it helps, you can get the code in this repository.
In this first edition of our series of tutorials we have seen how to seamlessly deploy a very simple piece of code using our product Titan. After that, we have seen how to consume the service straight from the Swagger UI interface and using Postman.
You can keep learning about how to use Titan in our next tutorial where we deploy our first ML model!
Titan can help you to radically reduce and simplify the effort required to put AI/ML models into production, enabling Data Science teams to be agile, more productive and closer to the business impact of their developments.
If you want to know more about how to start using Titan or getting a free demo, please visit our website or drop us a line at email@example.com.
If you prefer, you can schedule a meeting with us here.