Skip to content

A minimal example of deploying an sklearn model in a FastAPI server (Shoutout to Ethan Swan @eswan18 for his PyCon 2023 tutorial).

Notifications You must be signed in to change notification settings

harshallmall/sklearn_fastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iris Prediction API

This repo contains an Iris prediction server. To start the application, run:

uvicorn app.main:app --host 0.0.0.0 --port 8000

Fetching Predictions

If the API server is running at http://localhost:8000, then the following should work in a local Python session:

>>> import requests
>>> response = requests.post(
...     "http://localhost:8000/predict",
...     json={
...         "sepal_width": 1,
...         "sepal_length": 1,
...         "petal_length": 1,
...         "petal_width": 1,
...     },
... )
>>> response.status_code
200
>>> response.json()
{'flower_type': 0}

About

A minimal example of deploying an sklearn model in a FastAPI server (Shoutout to Ethan Swan @eswan18 for his PyCon 2023 tutorial).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages