Giter VIP home page Giter VIP logo

blip-image-captioning-docker's Introduction

BLIP Image Captioning inside a Docker Container with simple API

Features

  • Worker Queue
  • Create Image Caption of Image by passing URL

API Endpoints

  • /captionImage GET

    • Get job results
  • /captionImage POST

    • Post a job to the queue
    • Takes json with imgurls: ['url1', 'url2', ...]
    • When job is done the result will be added to the result list
  • /captionImageBlocking POST

    • Post a job to the queue
    • Takes json with "imgurls": ['url1', 'url2', ...]
    • Waits for job to finish and returns the result in the response

Setup/Installation

  • I assume that you have docker installed and a CUDA capable GPU
  • I suggest that you run everything locally first to verify that every thing works as the docker image build can take quite long
  • After running it locally for the first time, there should be a /checkpoints folder with the BLIP model
    • So the docker container can copy it and doesnt need to download it again

Example

POST /captionImage

Request:

{
    "imgurl": ["https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg?auto=compress&cs=tinysrgb&w=1600"]
}

Response:

{
    "id": "4fbc68319cd6491daf7451139f58b6c7",
    "msg": "Job Started!"
}

POST /captionImageBlocking

Request:

{
    "imgurl": ["https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg?auto=compress&cs=tinysrgb&w=1600", "https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg?auto=compress&cs=tinysrgb&w=1600"]
}

Response:

{
    "id": "93496917b71b44d49138cab7e4c5451d",
    "msg": "Job finished!",
    "result": [
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow",
        "a black and white cat sitting in the snow"
    ]
}

GET /captionImage

Response:

[
    {
        "id": "4fbc68319cd6491daf7451139f58b6c7",
        "result": [
            "a white kitten with blue eyes sitting on a leopard print blanket"
        ]
    }
]

blip-image-captioning-docker's People

Contributors

sk4p3 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

blip-image-captioning-docker's Issues

checkpoints missing

When running the powershell file
docker build -t py-worker .
it fails on
#7 [2/7] ADD ./checkpoints /app/checkpoints
#7 sha256:66385eb2b9e14ebca5144f4dc9ed2f54ac7cfa4adfaee182aaf2035af0103d3b
#7 ERROR: "/checkpoints" not found: not found

the readme says:

  • After running it locally for the first time, there should be a /checkpoints folder with the BLIP model
    • So the docker container can copy it and doesnt need to download it again

It seems that there is step missing somewhere.

Shall I just drop model_base_caption_capfilt_large.pth in the folder?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.