![]() ![]() Processes the image by transforming it into a tensor ready suitable for model input.Checks for an API request to be received.Establishes an endpoint for the model predict function.We can also check out the GitHub repository we used for this project which includes all the files we used for this FastAPI application, the Dockerfile, and any other accompanying file.Īt a high level, the FastAPI application (in main.py) sets up the following processes: However, we will be highlighting a few files and code snippets below that we used for this demo application. This tutorial isn’t meant to be a deep dive into FastAPI development, but rather a guide on how to deploy a FastAPI application on Gradient to serve our model. PrerequisitesĪs a starting point for this tutorial, we will need to have: We will create a Docker image that contains that FastAPI app, and then deploy that image along with the model on Gradient to allow users access to our model. This endpoint will accept an API request, generate a model output and return that output to the sender. What we will be doing in the tutorial below is creating a FastAPI application that will serve our model by providing an endpoint that our model can be called from. FastAPI is a modern, high performance web framework for building APIs that are easy to use and great for creating apps to service a model. The goal of this guide is to show users how to take their own trained models, and deploy them on Gradient Deployments by providing an endpoint that users can send requests to return outputs generated from their model. We can confirm our deployment is offline by checking the status at the top of the deployment page in the Paperspace Console. Otherwise, the owner's account will be charged for compute as long as the deployment is running. Please ensure to turn it off by changing replicas: 0 or adding an enabled: false flag to the specification or deleting the Deployment entirely. Important: At the end of this tutorial, we will have spun up a Gradient Deployment.
0 Comments
Leave a Reply. |