Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
DelphiFireMonkeyProductivity

Can ChatGPT Be Used To Generate Art?

Little FMX

Art and technology have been irrevocably intertwined throughout history, from cave paintings to Renaissance frescoes. Today, the combination of technological advances and age old artistic traditions has given rise to new avenues for art production — from 3D printing to AI-based approaches such as Stable Diffusion, Midjourney, and Dall-E. But what about ChatGPT? And can it really be used to generate art?

This article is part of the Delphi Fan Art Contest series where you can celebrate Delphi and share your Delphi themed digital fan art and AI art on the Delphi Reddit.

What is ChatGPT?

ChatGPT is a new chatbot powered by the GPT-3 knowledge base. The chatbot can help answer questions and provide helpful advice on a variety of topics. ChatGPT utilizes natural language processing (NLP) technology to understand written and spoken language, allowing it to interact with users in a meaningful way. This chatbot is designed to simulate human conversation by providing relevant information through its intelligent chatbot interface. It also can recognize actions like requesting information and will respond accordingly. However, ChatGPT can also write code (including Delphi code) and this code can take the format of various graphical file formats such as SVG.

What is the SVG format?

SVG is a powerful and versatile computer graphics format. SVG stands for Scalable Vector Graphics, which describes the SVG file format that is used to author two-dimensional vector graphics. SVG files are composed of simple XML and can be large or small in size, depending on their content and level of detail. SVG files can display up to 16 million colors with crisp edges which scale perfectly across any device or platform, making SVG an ideal choice for creating sophisticated, responsive visuals. SVG also offers unique capabilities such as animation, masking and clipping, which would otherwise be difficult or impossible to achieve using other formats. With SVG’s wide range of features and flexibility, it’s no wonder why some artists and developers prefer SVG over other computer graphic formats.

How can I access ChatGPT from Delphi?

Delphi is a powerful cross-platform solution for Android, iOS, macOS, Windows, and Linux. There are a number of different clients that have been built which allow you to interact with ChatGPT via an API from within your Delphi applications. Each of them requires an Open AI API key and they range from simple to robust.

DelphiChatGPT.pas

The first one we are going to look at is DelphiChatGPT.pas from Jarrod Davis at tinyBigGAMES. You can access the source code on GitHub and it is all contained within one file. Take a look.

Delphi Chat GPT Project

The second project here is a sample project built by François PIETTE who is the developer of ICS (Internet Component Suite) for Delphi. It is a demo project built using VCL and ICS to connect with the Open AI API. Take a look.

Delphi Open AI & ChatGPT & DALL-E

The last and most extensive Open AI integration with Delphi we’re going to discuss in this article is by developer HemulGM. There are three separate projects. The first is a Delphi OpenAI API which supports Models, Completions, Edits, Images, Embeddings, Files, Fine-tunes, Moderations, Engines (Depricated) from OpenAI. The other two projects are Delphi FireMonkey clients for ChatGPT and DALL-E which have a similar chat interface as is seen on the web for chatbots.

https://github.com/HemulGM/DelphiOpenAI

https://github.com/HemulGM/ChatGPT

https://github.com/HemulGM/DALL-E

How can I use ChatGPT to create artwork?

ChatGPT is able to produce SVG files. You can ask to create a file containing elements you are looking for and it will write out the file for you. For example, if you want a YouTube thumbnail size image you can ask ChatGPT via a prompt such as “Write an svg file of a youtube thumbnail with a red spartan helmet on a white background” and it will respond with something like the following:

It gets the SVG format correct but in this case I asked it to draw a spartan helmet and while it attempted to do that the result wasn’t quite it (see below). It was still a great effort for a first try. I’ll leave it as an exercise for the reader to explore more in this area with ChatGPT.

ChatGPT Spartan

Can ChatGPT create ASCII art?

ASCII art is a form of digital artwork created from ascii characters which as numerical values which equate to a specific set of characters. It has become more popular as an online art due to the common nature of its key components: ascii works are able to be shared with ease between online platforms. Although ascii art has been around since the 1960s, it has become even more creative and intricate in recent years as computer software advances, allowing ASCII artists to use different fonts and colors as well as shapes. Its modern appeal is seen in tweets, emails, website landing pages and of course artwork galleries coming into trend on the internet.

Let’s ask ChatGPT to create ASCII art of a cat.

Ascii Art Cat

As you can see in the screenshot above ChatGPT did pretty well with some simple ASCII art. Other attempts to have it create Greek columns and Spartan helmets in ASCII art were unsuccessful however.

Delphi Digital Fan Art Contest Collections: Developers And FireMonkeys

The Delphi Fan Art contest is well underway and the Delphi community has responded with a fantastic lineup of submissions. From intricate landscapes to elaborate abstract pieces, we’ve been amazed by Delphi users’ collective talent and imagination. Everyone who’s taken part so far is to be commended for the effort they put into each of their unique creations. With still plenty of time left to enter, any Delphi fan out there not yet involved should take the opportunity right away! It’s an exciting few weeks full of vibrant artistry, and it’s definitely worth taking part to celebrate Delphi.

FireMonkey

Coding Gorilla

 

Cyberpunk Coder

Delphi Spartan

Matrix Warrior

Ready to get started with the Delphi Fan Art Contest?

In conclusion, ChatGPT offers an exciting way to create art using artificial intelligence and OpenAI, and it is accessible from your Delphi apps via API. We have explored several easy steps on how to use ChatGPT and access Open AI through Delphi. Not only can you make amazing art, but you also have the chance to submit your work in the Delphi Fan Art Contest! Explore different ideas and look at other entries submitted by other creators. Pick a challenge and show off your skills in the contest today! Ready to get started with the Delphi Fan Art Contest?

Then what are you waiting for? Unleash your creativity and participate today!

Don’t have Delphi yet? Download it and get started!


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES