Generate SEO-optimized, accessibility-friendly alt text for images using Cloudflare’s AI. Upload images or provide image URLs, and receive concise, keyword-rich descriptions in multiple languages.
- Generate SEO-friendly alt text for images
- Supports multiple languages: English, German, French, Italian, Portuguese, Hindi, Spanish, and Thai
- Works with image uploads or URLs
- Powered by Cloudflare Workers
While the AI-powered alt text generator provides useful descriptions, there are some known issues:
- Quality of Alt Tags: The generated alt tags are generally good, but in some cases, they may not be perfectly accurate or descriptive, particularly for complex images.
- Language Support: Although the model supports multiple languages, the quality of alt tags in languages other than English may be lower, and some languages may produce less accurate results.
One potential enhancement to improve the quality of the generated alt tags is to integrate a second AI model to validate the alt text before returning it. This secondary model could cross-check the description for accuracy, clarity, and language appropriateness, ensuring better results across all supported languages.
- Cloudflare Workers
- Node.js and npm installed
git clone https://github.com/Leon338/alt-text-ai
cd alt-text-ai
npm install
- POST
/agree
: Initialize and agree to use the AI model. - POST
/describe
: Generate alt text for an image in the specified language.
Before you can use the model, you need to run the /agree
route once to activate the AI model:
curl -X POST https://your-worker-url/agree
You can either send a JSON request with an image URL or upload the image directly.
- Request with Image URL (JSON):
curl -X POST https://your-worker-url/describe?lang=en \ -H "Content-Type: application/json" \ -d '{"url": "https://www.gstatic.com/webp/gallery/4.sm.jpg"}'
- Direct Image Upload (Binary):
curl -X POST https://your-worker-url/describe?lang=en \ -H "Content-Type: image/jpeg" \ -d "@path/to/image.jpg"