Back to templates

Template details

Alt Image Generator

A Flask API that generates a one-sentence alt-text description for any image using Salesforce's BLIP model on Replicate.

About this template

Alt Image Generator is a Flask API template that generates a one-sentence alt-text description for any image using Salesforce's BLIP model hosted on Replicate.

What is Alt Image Generator?

Alt Image Generator is a Flask-based web API that accepts an image URL and returns an AI-generated alt text. It uses the BLIP model from Salesforce via the Replicate platform, and is designed as a deployable template with a Vercel one-click deployment button. The project is maintained by nutlope on GitHub (repository: nutlope/alt-text-generator) and also exists in a TypeScript version in the vercel/examples repository.

Key Features

  • Simple API interface — Send a GET request to the /generate endpoint with an imageUrl query parameter, and receive a one-sentence description of the image in return.
  • Powered by BLIP — Uses Salesforce's BLIP image captioning model, a state-of-the-art model for image understanding, served through Replicate's API.
  • Flask framework — Built with Python's Flask microframework, making it lightweight and easy to understand or modify.
  • One-click Vercel deployment — The repository includes a Deploy with Vercel button that clones the repo and sets up the REPLICATE_API_KEY environment variable automatically.
  • Local development workflow — Run vercel dev after installing the Vercel CLI to start a local server at http://localhost:3000.
  • Example curl usage — The README demonstrates how to test the API with curl http://localhost:3000/generate?imageUrl=https://dub.sh/confpic.
  • TypeScript alternative — A separate TypeScript version is available in the vercel/examples repository for developers who prefer a Node.js stack.

Who is it for?

Alt Image Generator is built for developers who need to generate alt text automatically, such as those building image-heavy applications that require accessibility tagging. It's also useful for content creators who manage large numbers of images and want to generate descriptions without manual effort. Web developers can use it as a reference implementation for integrating Replicate's image captioning models into their own projects.

What can you do with Alt Image Generator?

  • Accessibility compliance: Generate alt text for every image on a website to meet WCAG standards without manually writing descriptions.
  • Content management: Automatically annotate product photos, blog images, or user uploads with descriptive captions.
  • Learning tool: Understand how to call Replicate's API from Flask and deploy an AI-powered endpoint on Vercel.

How does Alt Image Generator work?

The workflow is straightforward: the client sends an image URL to the /generate endpoint, the Flask app forwards the image to Replicate's BLIP model, and the model returns a textual description that is sent back to the client. To run it locally, clone the repo, add your Replicate API key to .env, install the Vercel CLI globally, and run vercel dev.

screenshot of Alt Image Generator on template0.com