Skip to content

aprilspeight/alt-text-generator

Repository files navigation

Alt-Text Generator

Illustration of a Gen AI Alt-Text Generator. The left side describes its function: generating alt text for image sets using Python and OpenAI. An arrow points from an image icon to a document icon, indicating the process of converting images to text and organizing them in a markdown file.

Need to generate alt-text for a bulk set of images? This sample provides a basic alt-text generator that iterates over images in a specified folder, converts each image to base64 data URL, generates alt-text for each converted image, and then organizes everything into a markdown file - providing both the file name and alt-text!

Note: If you only need to generate alt-text for a single image, check out the Single Generator.

✅ Requirements

Run the Script

  1. Make sure your .env file is set up with your OPENAI_API_KEY.
  2. Open a terminal in the project directory.
  3. Run pip install -r requirements.txt to install dependencies.
  4. Run the script by providing the path to the folder with your images: python bulk-generator.py ./images (You can replace ./images with any folder path you want.)

📦 Resources

🚨 Contact

Have a question or issue trying the sample? Submit an issue to the repo!

About

Generate alt-text for images with AI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages