This microservice uses FastAPI to explore the MobileSam segmentation model as a RESTful API. The service allows users to upload images and get segmentation results.
Note
- The FastAPI is defined in the server.py file.
- A Dokerfile is created to enable the docker image building and runing.
- This README file is created to provide clear instructions for setting up, running, and interacting with the service.
-
Clone this repository:
git clone https://github.com/fxshan/mobilesam-task.git cd mobilesam-task
-
Install the Requirements
pip install -r requirements.txt
Run the FastAPI server:
uvicorn server:app --reload
The service will be available at http://localhost:8000/docs.
-
Ensure Docker is installed: Make sure Docker is installed on your system. If not, you can download and install it from Docker's official website.
-
Build the Docker image:
docker build -t mobilesam-service .
-
Run the Docker container:
docker run -d -p 8000:8000 mobilesam-service
The service will be available at http://localhost:8000/docs.
- POST /segment-image Upload an image file through [Browse] button.
- Then [Execute] it.
- The Server response shows the segmentation results.