|
| 1 | +--- |
| 2 | +title: Image-to-Text |
| 3 | +--- |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The `image-to-text` pipeline converts images into text captions. This pipeline is powered by the latest models in the HuggingFace [text-to-image](https://huggingface.co/models?pipeline_tag=text-to-image) pipeline. |
| 8 | + |
| 9 | +<div align="center"> |
| 10 | + |
| 11 | +</div> |
| 12 | + |
| 13 | +## Models |
| 14 | + |
| 15 | +### Warm Models |
| 16 | + |
| 17 | +The current warm model requested for the `image-to-text` pipeline is: |
| 18 | + |
| 19 | +- [Salesforce/blip-image-captioning-large](https://huggingface.co/Salesforce/blip-image-captioning-large) |
| 20 | + |
| 21 | +<Tip> |
| 22 | + For faster responses with different |
| 23 | + [image-to-text](https://huggingface.co/models?pipeline_tag=text-to-image) |
| 24 | + diffusion models, ask Orchestrators to load it on their GPU via the `ai-video` |
| 25 | + channel in [Discord Server](https://discord.gg/livepeer). |
| 26 | +</Tip> |
| 27 | + |
| 28 | +### On-Demand Models |
| 29 | + |
| 30 | +The following models have been tested and verified for the `image-to-text` |
| 31 | +pipeline: |
| 32 | + |
| 33 | +<Note> |
| 34 | + If a specific model you wish to use is not listed, please submit a [feature |
| 35 | + request](https://github.com/livepeer/ai-worker/issues/new?assignees=&labels=enhancement%2Cmodel&projects=&template=model_request.yml) |
| 36 | + on GitHub to get the model verified and added to the list. |
| 37 | +</Note> |
| 38 | + |
| 39 | +{/* prettier-ignore */} |
| 40 | +<Accordion title="Tested and Verified Diffusion Models"> |
| 41 | + - [Salesforce/blip-image-captioning-large](https://huggingface.co/Salesforce/blip-image-captioning-large) |
| 42 | +</Accordion> |
| 43 | + |
| 44 | +## Basic Usage Instructions |
| 45 | + |
| 46 | +<Tip> |
| 47 | + For a detailed understanding of the `image-to-text` endpoint and to experiment |
| 48 | + with the API, see the [Livepeer AI API |
| 49 | + Reference](/ai/api-reference/image-to-text). |
| 50 | +</Tip> |
| 51 | + |
| 52 | +To create an image caption using the `image-to-text` pipeline, submit a |
| 53 | +`POST` request to the Gateway's `image-to-text` API endpoint: |
| 54 | + |
| 55 | +```bash |
| 56 | +curl -X POST "https://<GATEWAY_IP>/image-to-text" \ |
| 57 | + -F model_id=Salesforce/blip-image-captioning-large \ |
| 58 | + -F image=@<PATH_TO_FILE> |
| 59 | +``` |
| 60 | + |
| 61 | +In this command: |
| 62 | + |
| 63 | +- `<GATEWAY_IP>` should be replaced with your AI Gateway's IP address. |
| 64 | +- `model_id` is the diffusion model to use. |
| 65 | +- `image` is the path to the image file to be captioned. |
| 66 | + |
| 67 | +<Note> |
| 68 | + Maximum request size: 50 MB |
| 69 | +</Note> |
| 70 | + |
| 71 | +For additional optional parameters, refer to the |
| 72 | +[Livepeer AI API Reference](/ai/api-reference/image-to-text). |
| 73 | + |
| 74 | +## Orchestrator Configuration |
| 75 | + |
| 76 | +To configure your Orchestrator to serve the `image-to-text` pipeline, refer to |
| 77 | +the [Orchestrator Configuration](/ai/orchestrators/get-started) guide. |
| 78 | + |
| 79 | +### System Requirements |
| 80 | + |
| 81 | +The following system requirements are recommended for optimal performance: |
| 82 | + |
| 83 | +- [NVIDIA GPU](https://developer.nvidia.com/cuda-gpus) with **at least 12GB** of |
| 84 | +VRAM. |
| 85 | + |
| 86 | +## API Reference |
| 87 | + |
| 88 | +<Card |
| 89 | + title="API Reference" |
| 90 | + icon="rectangle-terminal" |
| 91 | + href="/ai/api-reference/image-to-text" |
| 92 | +> |
| 93 | + Explore the `image-to-text` endpoint and experiment with the API in the |
| 94 | + Livepeer AI API Reference. |
| 95 | +</Card> |
0 commit comments