This API uses the DenseNet121 model, trained on a private cervical cancer cell dataset. After training, the model is deployed as an API using LitServe and other frameworks.
git clone https://github.com/duythanh22/cervical-cancer-cls-api.git
cd cervical-cancer-cls-api/
export PYTHONPATH=$PYTHONPATH:/cervical-cancer-cls-api
pip install -r requirements.txt
python src/main.py
Run the test client:
python client.py --image ./data/sample.jpg
Or use this terminal command:
curl -X POST "http://127.0.0.1:8000/v1/api/predict" \
-H "Authorization: Bearer ...key..." \
-F "request=@path/to/your/file" \
-k
Prometheus metrics available at v1/api/metrics
.
To containerize and run the application using Docker, follow these steps:
Ensure you are in the root directory of the project where the Dockerfile
is located. Then, build the Docker image:
docker build -t cervical-cancer-cls-api .
Once the image is built, you can run a container using the following command:
docker run -d -p 8000:8000 --name cervical-cancer-api-container cervical-cancer-cls-api
This will expose the API on port 8000.
Use the same commands for testing the API as described above, ensuring the host URL points to http://127.0.0.1:8000
.
To stop the container, run:
docker stop cervical-cancer-api-container
To remove the container, run:
docker rm cervical-cancer-api-container
- Make sure Docker is installed and running on your system before starting.
- If you modify the code, rebuild the image to apply the changes using the
docker build
command.