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's written in Python and 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 tools that offer more functionality and helper functions for ML applications.

Gradient integrates Flask natively for deploying models and includes a pre-built Flask image out of the box which is updated regularly. Alternatively, it's possible to use your own custom Flask 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. This can be achieved via the web UI, the CLI, or via Workflows.

Select 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.