-
Clone the repository:
git clone https://github.com/askaresh/blip-image-captioning-api.git -
Navigate to the project directory:
cd blip-image-captioning-api -
Run the run.sh file
bash run.shThe API will be accessible at
http://localhost:8004.
The API provides a single endpoint for generating image captions:
POST /caption: Generate a caption for an image.
To generate a caption for a list of images, send a POST request to the /caption endpoint with the following parameters:
image(required): The image file to generate a caption for. The image should be sent as a multipart form data.text(optional): An optional text input to guide the caption generation process. This can be used for conditional image captioning.
Example using cURL:
curl -X POST -F "image=@path/to/image.jpg" -F "text=optional text input" http://localhost:8000/captionSee also ex_sample.sh.
An example for generating captions in python is in test-blip2.py.
The API will respond with a JSON object containing the generated captions:
{
"caption": ["a person riding a bike on a city street"]
}This project is licensed under the MIT License. See the LICENSE file for more information.