In this tutorial you will learn about APIs and microservice management. You will learn the principles of API and microservice design for Machine Learning (ML) inference so that you can design your own ML solution.
FastAPI is a modern, fast, web framework for building APIs with Python 3.6+ based on standard Python type hints.
The following parts will be covered with this tutorial:
Introduction to APIs and microservices
REST API-based microservices
Hands-on implementation of serving an ML model as an API
Developing a microservice using Docker (you will learn how to setup your Dockerfile for your container image)
Testing the API service.
The artifacts which we will use in the tutorial are:
model data scaler - it scales input data to be representative for the ML model (classifier).
SVC classifier - ML model, classification classifier, which makes binary classification (predictions of weather).
API is the gateway that enables developers to communicate with an application. APIs enable two things:
Access to an application's data
The use of an application's functionality.
On the other hand, Microservices are a modern way of designing and deploying apps to run a service.
So in this video example we will apply the principles of APIs and microservices and develop a RESTful API service to serve the ML model. The ML model we will serve will be for the business problem - weather prediction using ML. We will use the FastAPI framework to serve the model as an API and Docker to containerize the API service into a microservice.
Some key points you should keep in mind:
A POST request is often used to create new resources. For ML applications, it is used to infer predictive ML models.
For feature definitions in variables Python based file we will use pydantic module: https://pydantic-docs.helpmanual.io/
uvicorn - is an ASGI (Asynchronous Server Gateway Interface) server implementation package (https://pypi.org/project/uvicorn/).
onnxruntime - used to deserialize and infer onnx models.
uvicorn-gunicorn-fastapi image on Docker Hub: https://hub.docker.com/r/tiangolo/uvi...
Docker documentation for RUN command: https://docs.docker.com/engine/refere...
Github repo for the tutorial: https://github.com/PacktPublishing/En...
Engineering MLOps book on Amazon: https://www.amazon.com/Engineering-ML...
#fastapi #microservices #api
Смотрите видео Microservices with FastAPI and Docker (Python based) - Hands on Tutorial онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Data Science Garage 20 Сентябрь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 7,866 раз и оно понравилось 136 людям.