liveBook · Manning

FastAPI

As explained in Software Engineering for Data Scientists

FastAPI is a Python web framework for building APIs with type-hint-based request validation and automatic interface documentation.

FastAPI converts Python code into an API, making a data science model callable from another server or environment. It supports both API prototyping and production deployment, while Pydantic validates incoming inputs. section 9.3 section 9.3.2

A minimal FastAPI workflow includes:

  • Install FastAPI and Uvicorn with pip; Uvicorn serves requests for the FastAPI application. section 9.3.2

Serving a churn prediction

A POST request sends total_day_minutes, total_day_calls, and num_customer_service_calls to /churn. The endpoint converts these fields into a pandas DataFrame, calls predict_proba, and returns a prob_of_churn value.

How Software Engineering for Data Scientists covers it

How deep it goes
Progresses from installation and a test route to typed model inputs, prediction handling, server launch, and client requests.
Examples
Uses a test message endpoint and a customer-churn probability endpoint exercised through Python requests.
What it assumes
Assumes basic Python and model-handling knowledge while introducing API routes, typed request models, and server launch.
What you can do after
Builds and operates a Python API that validates structured inputs and serves machine-learning predictions.
How it connects
Connects API development with Pydantic, Uvicorn, REST APIs, pandas, joblib, Flask, and Django REST Framework.

Also explained in

Compare how 6 books explain FastAPI →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Engineering for Data Scientists. The section links point to the parts of the book it draws on.