Tutorials - Ethan Swan: Building a Model Prediction Server

Learn how to build a model prediction server using Pydantic, FastAPI, and other popular Python libraries and tools, and explore options for deployment on various cloud platforms.

Key takeaways
  • Use Pydantic for data validation: Pydantic is a library that allows for easy data validation and is very tightly integrated with Python.
  • Use FastAPI for building a model prediction server: FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
  • Create a virtual environment: Create a virtual environment using python -m venv venv to isolate the dependencies for your project.
  • Use pytest for testing: pytest is a powerful testing framework for Python that allows for easy testing of your code.
  • Use conftest for configuration of tests: conftest is a file that can be used to configure tests.
  • Use pytest.fixture to define a test client: pytest.fixture can be used to define a test client that can be used to test your API.
  • Use HTTPX for making HTTP requests: HTTPX is a library that can be used to make HTTP requests.
  • Use pandas for data manipulation: pandas is a library that can be used for data manipulation and analysis.
  • Use scikit-learn for machine learning: scikit-learn is a library that can be used for machine learning.
  • Use pickle for model serialization: pickle is a library that can be used to serialize and deserialize Python objects.
  • Use JSON for data serialization: JSON is a format that can be used to serialize and deserialize data.
  • Use requests for making HTTP requests: requests is a library that can be used to make HTTP requests.
  • Use curl for making HTTP requests: curl is a command-line tool that can be used to make HTTP requests.
  • Use Docker for containerization: Docker is a containerization platform that can be used to run your application in a container.
  • Use Azure for cloud deployment: Azure is a cloud platform that can be used to deploy your application.
  • Use Linode for cloud deployment: Linode is a cloud platform that can be used to deploy your application.
  • Use DigitalOcean for cloud deployment: DigitalOcean is a cloud platform that can be used to deploy your application.