Jump to content

AltTextGpt: Module To Automate Generating Alt Text For All Images In Site


notplants
 Share

Recommended Posts

AltTextGpt for ProcessWire

This ProcessWire module, AltTextGPT, is an interface for generating alt text for all of the images in your website, using the ChatGPT Open AI API.

Using the API requires an account with the Open AI API and costs money, although its pay-what-you-use and the charges are minimal. For example, alt text was generated for 200 images, using 94 cents of Open AI Credits. You can create an account with Open AI, from this link, and then once you have an API key, you can enter it below, or configure it as a permanent setting for this module via Modules->Configure->AltTextGpt.

After configuring the API key as described above, you can then use the form below to generate alt text for images in the site. The module will attempt to generate alt txt for every image that currently has no alt text, one at a time. Generating alt text takes a few seconds for each image, so this is not an instantaneous process. For this reason, if you have many images, we suggest generating alt text for the images in batches. You can also set a batch size below, generating alt text for 10 or 20 images at a time, and then repeating the process, until you have generated alt text for all of the images in the site. After each run, the table above should show that there are fewer images without alt text in the site, until eventually the table indicates that there are 0 images in the site without alt text.

Note, for alt text to show up for images uploaded in the body of a CKEditor field, this configuration must be set for that field as described in this comment.

How to install this module

  1. Copy all of the module files to /site/modules/AltTextGpt/.

  2. In your admin, go to Modules > Refresh.

  3. Click “Install” for the “AltTextGpt” module (on the “Site” tab).

screenshot of the module interface

 

The code for the module is tested and working and is currently here: https://github.com/mhfowler/AltTextGpt

Edited by notplants
  • Like 6
  • Thanks 1
Link to comment
Share on other sites

  • notplants changed the title to AltTextGpt: Module To Automate Generating Alt Text For All Images In Site

note: this currently requires the images being described to be on URLs publicly accessible to the internet, as it passes image URLs to Open AI to generate captions for. I just merged a PR to allow for custom setting of a Base URL to use in different deployment settings.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...