Get descriptions of images using OpenAI's GPT models.
Project description
TextFromImage
Get descriptions of images using OpenAI's GPT models.
Installation
pip install textfromimage
Usage
import textfromimage
# Option 1: Set your OpenAI API key as an environment variable
import os
os.environ['OPENAI_API_KEY'] = 'your-api-key'
# Option 2: Provide your API key directly (not recommended for security reasons)
description = textfromimage.get_description('https://example.com/image.jpg', api_key='your-api-key')
# Get a description of the image
description = textfromimage.get_description('https://example.com/image.jpg')
print(description)
Parameters
- image_url (str): The URL of the image.
- prompt (str, optional): The prompt for the description (default: "What's in this image?").
- model (str, optional): The OpenAI model to use (default: "gpt-4o").
- api_key (str, optional): Your OpenAI API key.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
textfromimage-0.1.0.tar.gz
(2.8 kB
view details)
Built Distribution
File details
Details for the file textfromimage-0.1.0.tar.gz
.
File metadata
- Download URL: textfromimage-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 483d433f8c773a0d040a40938797d8548b0289f931ed92c8ff2fbf31a196e59b |
|
MD5 | 5afd27bf74210c0515d3211b22e87964 |
|
BLAKE2b-256 | 1d878e3dab60872485ba467ad52fcc7533d7f9f9ad70c5b114ce20abf2ed95ce |
File details
Details for the file textfromimage-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: textfromimage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c81e5b252ac8d164ac6cddeb6a76c2f8c31bd91697ebe4584335b2eddfbe3839 |
|
MD5 | 3888ff0eff2354f3890fab781d8b011f |
|
BLAKE2b-256 | 5a490b99c9028e0e1516bacc65240c3cba7a2488ecd19ec2114dab8be39f20db |