Skip to content

Serving cervical cancer cell classification (Pytorch model) with LitServe

Notifications You must be signed in to change notification settings

duythanh22/cervical-cancer-cls-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cervical cancer cell classification API

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.

Installation and Usage

1. Clone the Repository

git clone https://github.com/duythanh22/cervical-cancer-cls-api.git

Navigate to the project directory and set python path

cd cervical-cancer-cls-api/
export PYTHONPATH=$PYTHONPATH:/cervical-cancer-cls-api

Install requirements

pip install -r requirements.txt

Run API

python src/main.py

Test the server

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

Check API monitoring metrics

Prometheus metrics available at v1/api/metrics.

2. Setup Using Docker

To containerize and run the application using Docker, follow these steps:

Build the Docker Image

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 .

Run the Docker Container

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.

Test the API in the Container

Use the same commands for testing the API as described above, ensuring the host URL points to http://127.0.0.1:8000.

Stop and Remove the Container

To stop the container, run:

docker stop cervical-cancer-api-container

To remove the container, run:

docker rm cervical-cancer-api-container

Notes

  • 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.

Test with unit test

About

Serving cervical cancer cell classification (Pytorch model) with LitServe

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published