Add a sub-module for supporting alt text generation from OpenAI

Created on 29 January 2024, 11 months ago

I'm not sure if this is the scope of this module, but could we utilise the OpenAI client and GPT 4 vision API to create a sub-module for suggesting alt text when an image is uploaded.

Each time the user uploads an image to the media gallery, we could hook into the form and send a GPT client event to describe the image and have that ready in the alt text for the user to review and override as necessary.

โœจ Feature request
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom andy_w

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @andy_w
  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom andy_w

    Added a sub-module, currently only works with the media gallery image upload.

  • First commit to issue fork.
  • Status changed to Needs work 10 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium mpp

    The prompt should be translatable in order to support multilingual.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia babu ankaian

    Hi,

    I suggest using another AI tool, ALTTEXTAI, to generate image alternative text. Additionally, we have a Drupal module called Automatic Alternative Text that supports generating ALT text for uploaded media files.

    Example Code:

        $data = array(
    		'image' => array(
    			'url' => 'https://upload.wikimedia.org/wikipedia/commons/6/63/Monarch_In_May.jpg'
    		),
    	);
    	$json_data = json_encode($data);
    
    	$Curl = 'https://alttext.ai/api/v1/images';
    	$access = '146971ebfd0cf123d9126f1e9e89f065';
    	$ch1 = curl_init();
    	curl_setopt($ch1, CURLOPT_URL,$Curl);
    	curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'X-API-Key: '.$access));
    	curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
    	curl_setopt($ch1, CURLOPT_CUSTOMREQUEST,"POST");
    	curl_setopt($ch1, CURLOPT_POSTFIELDS, $json_data);
    	
    	$status_code = curl_getinfo($ch1, CURLINFO_HTTP_CODE); 
    	$result = curl_exec($ch1);
    	curl_close($ch1);
    	$response = json_decode($result, true);
    
    	$response1 = array(
    		"alt_text" => $response['alt_text'],
    		"img_url" => $url,
    	);
    	echo json_encode($response1);
    
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States w01f

    Just reporting back here that there's also the AI Image Alt Text module โ†’ option for the AI suite of modules โ†’ .

  • ๐Ÿ‡ฏ๐Ÿ‡ดJordan rahaf albawab Amman

    I added some changes to the MR to make it work with media edit and support the DropzoneJS module.

  • ๐Ÿ‡ฏ๐Ÿ‡ดJordan Rajab Natshah Jordan

    rajab natshah โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    9 days ago
    Total: 143s
    #363496
Production build 0.71.5 2024