Metadata-Version: 2.1
Name: pytorch-clip-interrogator
Version: 2023.2.19.13
Summary: Prompt engineering tool using BLIP 1/2 + CLIP Interrogate approach.
Home-page: UNKNOWN
Author: Sergei Belousov aka BeS
Author-email: sergei.o.belousov@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: wheel
Requires-Dist: torch
Requires-Dist: numpy
Requires-Dist: transformers
Requires-Dist: tokenizers
Requires-Dist: accelerate
Requires-Dist: datasets
Requires-Dist: addict (==2.4.0)
Requires-Dist: tqdm (==4.64.1)
Requires-Dist: faiss-cpu (==1.7.3)
Requires-Dist: Pillow

# pytorch_clip_interrogator: Image-To-Promt.
[![Downloads](https://pepy.tech/badge/pytorch_clip_interrogator)](https://pepy.tech/project/pytorch_clip_interrogator)
[![Downloads](https://pepy.tech/badge/pytorch_clip_interrogator/month)](https://pepy.tech/project/pytorch_clip_interrogator)
[![Downloads](https://pepy.tech/badge/pytorch_clip_interrogator/week)](https://pepy.tech/project/pytorch_clip_interrogator)


## Install package

```bash
pip install pytorch_clip_interrogator
```

## Install the latest version

```bash
pip install --upgrade git+https://github.com/bes-dev/pytorch_clip_interrogator.git
```

## Features
- Fully compatible with models from Huggingface.
- Supports BLIP 1/2 model.
- Support batch processing.

## Usage

### Simple code

```python
import torch
import requests
from PIL import Image
from pytorch_clip_interrogator import PromptEngineer

# build pipeline
pipe = PromptEngineer(
    blip_model="Salesforce/blip2-opt-2.7b",
    clip_model="openai/clip-vit-base-patch32",
    device="cuda",
    torch_dtype=torch.float16
)

# load image
img_url = 'https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg'
image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')


# generate caption
print(pipe(image))
```


