Production-ready Image Captioning API powered by PyTorch & FastAPI.
251
Production-ready Image Captioning Service powered by PyTorch and FastAPI. Generate human-like captions for images with a single API call.
The easiest way to run the API is using Docker:
docker run -p 8000:8000 atakanemree/image-caption-api:latest
Once running, access the API documentation at: http://localhost:8000/docs
curl http://localhost:8000/health
curl -X POST \
http://localhost:8000/predict \
-H 'Content-Type: multipart/form-data' \
-F '[email protected]'
Response:
{
"predicted_caption": "a dog running on the grass",
"confidence": 0.85,
"timestamp": "2023-11-29T12:00:00"
}
curl -X POST \
http://localhost:8000/predict/batch \
-H 'Content-Type: multipart/form-data' \
-F '[email protected]' \
-F '[email protected]'
| Tag | Description | Size | Use Case |
|---|---|---|---|
latest / latest-cpu | CPU optimized version | ~800MB | General purpose, low cost deployment |
latest-gpu | GPU enabled (CUDA 11.8) | ~2.5GB | High throughput, training |
docker run --gpus all -p 8000:8000 atakanemree/image-caption-api:latest-gpu
You can configure the container using environment variables:
docker run -p 8000:8000 \
-e API_WORKERS=4 \
-e LOG_LEVEL=INFO \
atakanemree/image-caption-api:latest
The system consists of a ResNet50 CNN for image feature extraction and an LSTM RNN for text generation. The API is built with FastAPI for high performance and easy integration.
For more details, source code, and training instructions, visit the GitHub Repository.
Content type
Image
Digest
sha256:b27193346…
Size
312.6 MB
Last updated
10 months ago
docker pull atakanemree/image-caption-api