Skip to content

Web API that uses the OpenAI service to generate images for text-based prompts. Uses Python, Flask and the OpenAI Library. Dockerized for ease of use.

Notifications You must be signed in to change notification settings

AydanBedingham/openai-image-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

openai-image-api

openai-image-api is a Web API written in Python that uses the OpenAI to generate images for text-based prompts.

Running Locally

Navigate to the openai-image-api directory.

cd openai-image-api

Install dependencies with pip

pip install -r requirements.txt

Set the 'OPENAI_API_KEY' environment variable:

export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Run the application with python

python app.py

API

GET /create?prompt=

curl --location 'http://127.0.0.1:5000/create?prompt=Cats'

Response

image/png

Docker

We also provide a Docker image to make it easier to run openai-image-api

docker build . -t openai-image-api -f docker/Dockerfile

Then run the image

docker run --rm -p 5000:5000 --env OPENAI_API_KEY=<YOUR_OPENAI_API_KEY> openai-image-api

About

Web API that uses the OpenAI service to generate images for text-based prompts. Uses Python, Flask and the OpenAI Library. Dockerized for ease of use.

Resources

Stars

Watchers

Forks