image_to_prompt
The image_to_prompt
function makes it easy to generate a textual description from an image. Below is a basic usage example:
from zerogpt.utils.tools.image_to_prompt import image_to_prompt
# Simple example
print(image_to_prompt('./image.png'))
You can also specify the desired prompt style using the prompt_style
parameter:
print(image_to_prompt('./image.png', prompt_style='short'))
Available prompt_style
options:
'tag'
— generates short descriptive tags'creative'
— produces a creative and artistic description'long'
— generates a detailed and elaborate description'short'
— returns a concise and compact description
Starting from version 1.3.0, the image_to_prompt
function supports multiple formats for passing images. Below are the main usage examples:
# Passing a local file path
print(image_to_prompt('./image.png'))
# Passing an image URL
print(image_to_prompt('https://example.com/image1'))
# Passing a list of image URLs
print(image_to_prompt(['https://example.com/image1', 'https://example.com/image2']))
Last updated