To build this API FastAPI and HuggingFace were used.
Image was derived from huggingface/transformers-pytorch-gpu
, that allows using GPU during prediction.
To compile and run the API use the following commands:
docker build -t cornelsen .
docker run -it --rm -p 8000:8000 cornelsen
Use docker-compose to make your experiments with API easier. Tweak docker-compose.yml
settings if needed.
docker-compose up --build
To shut the API down use docker-compose down
This API gets JSON as an input. Here is an example:
Input:
{
"text": "Sie fährt ein grünes Auto."
}
Output:
{
"message": "OK",
"received": "Sie fährt ein grünes Auto.",
"score": "neutral"
}
You can get additional information on localhost:8000/docs
.
To deploy this solution into the cloud we need:
- Adding proper testing
- Adding CI/CD pipeline
- Add load balancer according to load expectations