This project was built to demonstrate how to build a dockerized python api utilizing a deep learning model. Check out the live demo here
https://huggingface.co/spaces/Shamima/similar-faqs
Install dependencies pip install -r requirements.txt
To run the server locally, run uvicorn main:app --reload
.
docker build -t dlapi .
to build the container.- If you're not running on 64-bit linux, instead run
docker buildx build --platform linux/amd64 -t dlapi .
. This will build the image using the correct architecture for Azure.
- If you're not running on 64-bit linux, instead run
docker run -d --name dlapi -p 80:80 dlapi
to run the container.docker ps
to view the container information.- Run
docker logs
to see logs from the container. You should seeUvicorn running on http://0.0.0.0:80
. If you don't see this, wait a bit and try runningdocker logs
again. - Visit
127.0.0.1
orlocalhost
to see the API server. Visitlocalhost/docs
to see API docs. - Run
docker stop dlapi
to stop the container.