DEV Community

Cover image for Visually explore OpenAI's Image APIs without coding custom UI
Sebastian Tiedtke
Sebastian Tiedtke

Posted on • Originally published at stateful.com

Visually explore OpenAI's Image APIs without coding custom UI

While chatGPT has been all the craze, OpenAI’s underlying APIs offer much more. Outside of GPT4, the core piece to chatGPT, OpenAI provides AI Image-Generation APIs under the DALL-E umbrella.

💡 OpenAI’s description: DALL·E 2 is an AI system that can create realistic images and art from a description in natural language. 👉 https://openai.com/product/dall-e-2

These APIs are plain amazing…! They allow you to take an existing image and describe in words what edits you’d like the AI to make for you. It's like magic!

🙌 No UI Coding Required

Edit image using words via AI

Edit a ball pit into the image? Easy!

You can learn how to use DALL-E's APIs without writing custom code. We'll showcase this using Runme, which lets you create Markdown notebooks with interactive Shell commands, similar to Jupyter for Python.

🛠 Please give Runme a spin, install here or search runme inside VS Code

My dog Luna 🐕 offered to help us make our point! Right below, you’ll see Luna at a doggy friend’s birthday party in real life. All we’re using is a simple scene prompt: “a happy german shepherd dog surrounded by cheeseburgers”:

Original image of Luna

Unedited image of Luna

Luna with faux cheeseburgers

No way Luna would sit this calmly if those cheeseburgers were real 🤭

👩‍💻 Try It Yourself

Head to https://platform.openai.com/ to get an API key and follow our Runme notebook. Depending on how much you plan on using the API, OpenAI puts a limit on its free tier.

The repo with the notebook is available here: https://github.com/sourishkrout/loon

Runme notebook for AI image editing

🖥 Skip The Notebook, Use The CLI

If you live in the terminal, use the Runme CLI instead. After you clone the repo, drop your OPENAI_API_KEY=<super secret> into your environment. Then, do this:

$ runme run --filename AI.md install-deps
$ runme run --filename AI.md run-scene | jq -r ".data[0]" # btw, output URL expires
{
  "url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-tm5BAbynhBsE9Lzy1HTD6sk0/user-7A9nqIQ8tVXN7epnIqZs6fca/img-Hc1KHk6lkJegAkMqUWSL9D0i.png?st=2023-04-18T13%3A56%3A07Z&se=2023-04-18T15%3A56%3A07Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2023-04-18T11%3A36%3A32Z&ske=2023-04-19T11%3A36%3A32Z&sks=b&skv=2021-08-06&sig=9oEyq1os4zwf6rvb67W1rPDkTsPd%2BZ%2B1VHi/gWaz17M%3D"
}
Enter fullscreen mode Exit fullscreen mode

Most terminal emulators will allow you to click the URL to open it in a browser. That's it!

🌠 Make Your Own

We've explained how to use your images within the Runme notebook. The originals are also included with the notebook in the repository. Interestingly, the more background you mask (let the AI know what not to preserve), the more drastically the AI morphs the scene. Let us know what you think. You can find us on Discord. Please drop by and share one of your own DALL-E impressions!

Thank you.

Top comments (1)

Collapse
 
degrammer profile image
Ruben Restrepo

Interesting! this is an exciting way to try out something speedy without building a UI