clean_fast_api status

clean_fast_api

This microservice follows clean architecture. It mainly serves as an example for serving ml models. The code has separate concerns for the routing, business logic, and data retrieval.

Technical details

It uses fastapi and uvicorn to create the http server and inject dependencies such as the FlowerRepository and FlowerService. The repository layer pulls in predictions from a random forrest classifier generated by modules/flower/create_iris_model.py and trained on the sklearn iris dataset.

CI/CD

It uses GitHub actions to statically typecheck the codebase using pyright.

Running the server

We use pyenv for managing our Python versions:

# set up virtual env
pyenv virtualenv 3.10 clean_fast_api
pyenv activate clean_fast_api

# install dependencies and run server
pip3 install -r requirements.txt
make server

If you don't use pyenv, make sure you match our Python version 3.10.2.

Viewing the schema

The microservice is documented using OpenAPI 3. You can view the documentation at: