Skip to content

Simple API endpoint for image alt description generation, powered by OpenAI GPT-4 with Vision

Notifications You must be signed in to change notification settings

cheeaun/img-alt-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

img-alt-api

Simple API endpoint for image alt description generation, powered by OpenAI GPT-4 with Vision.

This is inspired by Ice Cubes. It's really cool.

Development

Requires Deno.

Add environment variable OPENAI_API_KEY. Could create a .env file and put the variable there too.

  • deno task dev - Run the server with watch mode, for development.
  • deno task debug - Run the server with watch mode and debugging, for development.
  • deno task start - Run the server.

Additional environment variables:

  • OPENAI_MODEL - OpenAI model to use, defaults to gpt-4o.

REST API Endpoints

  • GET /?image=<image-url>
  • POST / with image key as multipart/form-data.

Response:

{
  "description": "a picture of a cat"
}

Error response:

{
  "error": "Failed to generate description"
}

License

MIT.

References