1. Learn
  2. /
  3. Courses
  4. /
  5. Deploying AI into Production with FastAPI

Connected

Exercise

Adding a new endpoint version

A customer of your penguin classification API has asked for an endpoint that pre-processes data from a space-delimited text string instead of a JSON dictionary. You need to add a "v2" schema and endpoint to your app to accept the new input format.

The FastAPI instance named app and the PenguinV1 class have been pre-loaded.

Instructions

100 XP
  • Add a PenguinV2 Pydantic model that accepts a parameter data as a string.
  • Add a v2 penguin classifier endpoint at /v2/penguin_classifier.
  • Use the v2 model as input for the v2 endpoint.