Flask

+ Gradient

How to use Gradient and

Flask

together

Easily deploy models with Flask on Gradient.

Flask is an open source web framework popular in machine learning primarily because it is written in Python (a familiar language) but also because it is simple, lightweight, and fast. It is less popular in large scale production environments than other model serving frameworks like TensorFlow Serving since it was not developed specifically for machine learning and lags behind these tools that offer more functionality and helper functions targeting this specific use case.

Gradient natively integrates Flask for deploying models and includes a pre-built Flask image out of the box which is updated regularly. Alternatively, customers can use a customized version of Flask by using their own Docker image hosted on a public or private Docker registry.

Deploying models with Flask

When creating a Deployment, you can select the prebuilt image or bring your own custom image. These options are possible via the web UI, the CLI, or defined as a step within an automated pipeline.

Selecting the prebuilt Flask image when creating a deployment

When using the CLI, the command would like something like this:

gradient deployments create \  

--name "my deployment" \
--deploymentType Flask \
--imageUrl paperspace/flask \
--machineType P5000 \
--instanceCount 2
...

Learn more about the Gradient Flask integration in the docs.