So for the past week or so, I've been working on a truly world changing free
and open source program that anyone can use and enjoy. What does it do? Well,
it lets you create 100% AI generated memes, fully automatic from start to finish. I'll
do a more detailed demonstration later in the video, but basically how it works is
first it sends an API request to GPT-4 with some general instructions to make the meme.
And then GPT-4 responds with the text of the meme that will be used, and an image
prompt to go with it. The image prompt then gets sent to another image generator API,
which creates and sends back the image. And then the app combines the image and
text into the final result and saves it. Yes, this will truly change the world.
Now you can control things more if you want,
like telling it specific things you want to make a meme about. For example,
with all of these you've been seeing, I told it to make memes about computers. But for these,
I told it to make some about cats. Like I said, the program is open source. I wrote it in Python,
but I will be making releases in EXE, or executable format to make it easier for people.
So you just have to click it and run it. It's all automatic. I'll put a link to the GitHub
repository in the description, and then you can get the latest version by going to the
releases section on the right. And then under each release is the EXE file. Oh and here's
something else. Just for fun, I created a fully automated Twitter account you can
follow that uses this script to automatically generate shitpost memes every six hours.
And yes, that is literally the instructions I gave it. I'll put a link to that in the
description. Be sure to check it out. Some of the stuff it comes up with is actually
genuinely funny in my opinion. Also, because it's automatic, you'll see the new memes at
the same time I do. So now let's go over to the computer and I'll give you a more hands-on
demonstration of all the features because it can do more than you probably assume.
So let's go check it out. All right, so here we are at the computer and this is
the program right here. This is the icon that I used AI to make. I think
it's pretty funny. So we can just run it and the first time I'll show you what happens.
So it's just going to open command prompt and it's going to say the settings file is not found.
So it's going to create a default settings file and then you can use the settings file or
not going forward, but it'll just create one. And also it's saying because there's no API keys file,
it'll also create that. So we can close to exit that. And now you can see that we
now have those two files. We can look at the settings later, but don't be afraid of this.
Literally all of this is optional. You don't have to touch it if you don't want,
but you will have to go into the API keys file and set at least OpenAI. This is literally the
only thing you have to change that is absolutely required. And that's because OpenAI is the API
for chatGPT. If you didn't know OpenAI created chatGPT and that's what we're using for the text.
So you need to have an OpenAI API key. You'll have to create an account and then I'll link
in the description, the help article for where to get that. You do have to pay for the API,
but it's very cheap. I think I worked it out to about one or two cents per meme effectively. Also,
I would highly recommend getting a ClipDrop account and an API key for that.
Stability AI and ClipDrop are actually owned by the same company,
but they have a couple different platforms. ClipDrop is just going to have way better
images than OpenAI. But if you only want to use OpenAI, theoretically, you can use
that for the images too. And up here are just some more instructions if you need some help.
Anyway, we can close these out and I'm just going to drag over some other files that
are preset. So now we can take a look at actually running the program and what it's
like. We can just click on that. And this is what you get at the moment, very simple. And
you can fully automate this with command line arguments, but I'm not going to get into that.
But let's say, enter a meme or subject or concept, and you can be as specific or
non-specific as you want, or you can just enter nothing and let it decide. So let's
do that. Let's just let it decide. And you can also enter a number of memes to create,
or again, enter nothing and just do one, but I'll just put one anyway.
You can see that it's going to tell you how many and the progress.
It'll tell you what meme text it created and the prompt it's going to use for the image itself.
So we'll see this text in the final image. This is used to create the image. So it automatically
closes when it's done and you'll see a new outputs folder and we can see what we got.
When Friday is finally here, but your bed is the only party you're attending. You know,
it's pretty clever. What can you say? And then there's also a log file just that shows a history
of the images generated. It'll give you a lot of information if you were just curious. So it'll
tell you the name of the file, the instructions it was given, any special instructions.
We'll go over that. The prompt and behind the scenes, if you enter nothing,
it'll literally just say "anything" to the AI. And again, we have the meme text and the image prompt,
and it tells you what platforms used to [make] the image. And just for fun,
we can do one that is a little bit more specific. We can type in something like "make a meme about
cats and computers", and you can write it in plain English, or you can just type in "computers".
You can really do whatever you want here. And we'll just do one again. And again,
you kind of get a preview of what it's going to make. And let's see what it did. When your cat
walks across your keyboard and deletes your 3000 word essay, and it generated a picture of a cat
on a keyboard. But now let's take a look at the settings because you can control quite a bit more.
This is what the settings file looks like. Yours might look a little bit different.
Mine has colors just because Notepad++ does some formatting for it. But basically these
things that are not indented are the settings names. And then on the right of the equal sign,
you put in whatever value, and it will tell you some of the possible values and defaults.
So we can see behind the scenes. First is basic instructions. And to be clear,
this is not the thing you typed in. So when I typed in a meme about cats and computers,
that is not what this was. This is a very much more general thing that you're telling
the AI. So let's say you wanted all the memes to be about, I don't know, red cars.
So we can say "you will create memes about red cars, and then we can go back to the generator.
We'll just hit enter and see what it does. And you can add additional context here if you want,
on top of the basic instructions. But this is like a more specific
one is what you type in here. Now we can open it up and see what it did.
And we can see, when you finally join the red car club and immediately feel
the speed. So I don't know whether that's funny or not, you can decide,
but you can see that it was a red car. So that's what that does. And again,
you can get an idea of how general it is just by the default prompt that I created,
which is "you will create funny memes that are clever and original and not cliche or lame."
Extremely vague, but this is literally telling the AI what it's supposed to do. You do have
to tell it to create memes, but basically this is the kind of thing you can put in.
You could also say sad memes or wholesome memes, whatever. And then this other one,
image special instructions, these are instructions specifically for when it creates the image prompt.
So you again could just keep this up here the same, but tell it to always generate
an image with a car in it or something like that. This again is very general,
but you can make it specific. The default is "the images should be photographic". So
I think they should be photographs. That's the default that I set, just because it was
generating a lot of sketches that didn't really look good, but you could say "the images should
be illustrations and even more maybe, and use the color blue a lot, but not exclusively."
So again, you can use plain English and literally just describe what you want.
And again, these are applying to all the images that are going to be created. And
let's actually type something in here. So let's type in artificial intelligence,
see what that does. And we can see illustration, blue shades. So it has blue in there.
And when we open it up, yep, that's a lot of blue and it's an illustration. So
it did what I said. Now we can look at some of the more advanced settings. You
don't necessarily need to change these. The first one I will point out is I have set the
image platform to ClipDrop just because it's so much better images than OpenAI.
I might change that just to make it easier for people,
but I really recommend it. You'll see what I mean. Anyway, text model, you can use GPT-4.
You can also use GPT-3.5. I don't know how the results will be. It'll probably be a
little bit cheaper. So if you really want to watch the cost, you can use a cheaper model.
Now for temperature, the best way to describe it is the randomness of the result. So
if you'd set it too high, like 2.0 or something like that,
it might generate just nonsense and not follow your instructions at all. If you put in like 0.1,
it'll probably follow your instructions exactly, but you won't get a lot of variation.
It'll probably generate a lot of the same ideas. So 1.0 I find is pretty decent starting point.
For the font, you can choose a custom font. If you want default is Arial, very common,
but you can also use any font that's built into your operating system. So this is a
page on Microsoft where they literally have a list of all the default fonts.
So if you wanted to do Comic Sans or something, you would put comic.ttf.
And it will check the system font directory or the same folder it's in. So if you have a
custom font that you want to use that's not installed by default, you can just
drop in the same folder and put it here. Base file name is just what it'll name the files.
Output is the output folder. Now the release channel is because the
app will actually check for new releases and updates and tell you if there's a new
version. I'm probably going to change that to all. I meant to set it as all,
but basically if you have it set to all, it'll also tell you about beta releases.
Stable is just full releases, or you can not have it check for updates at all if
you find it annoying. Or if you wanted to ignore this config file altogether,
you can set use this config to false and it'll just go with the default settings,
which is the original settings for this one anyway. Now finally, here is all the actual code.
I am not going to go through all this, obviously, it'll take way too much time.
The main thing I want to show you is the more behind the scenes of how the formatting works
and the actual prompt that literally gets sent to ChatGPT. So you can see that basically,
in addition to the stuff that you saw, like the user inputting the prompt and
the basic instructions and the special image instructions, that's all here.
But this is what's called the system prompt. And the system prompt is, again,
the general instructions for what you're telling the chatbot, how it should behave. To give you
an idea, I believe ChatGPT, the default is, "You are a helpful assistant." So it's not
anything having to do with the prompts, that like kind of sets the stage for the prompts.
It's hard to explain, so let me just read it out. All of these go into the system prompt,
and I literally in plain English tell the chatbot,
"you are a meme generator with the following formatting instructions. Each meme will
consist of text that appears at the top and an image to go along with it. The user will
send you a message with a general theme or concept on which you will base the meme.
The user may choose to send you a text saying something like anything or whatever you want,
or even no text at all, which you should not take literally,
but take to mean that they wish you to come up with something yourself." This part I added in,
"the memes don't necessarily need to start with when, but they can," because literally every
single meme it was generating was "when you blah, blah, blah," and it was getting kind of annoying.
And then what I do is tell it how to respond. So first I want it to respond with the text of the
meme that will be displayed, and then some text that will be used for the image prompt for the
AI generator. And so you can read all that if you want. And then because I programmatically
get the text from the response, I tell it to specifically respond in a certain format,
which basically is just the meme text and then the image prompt below it, so I can pull that out.
So that is a variable for the format instructions. I just broke this up
for my own sanity, but this continues into the system prompt. You can see down here,
the system prompt ends up being the format instructions plus the basic instructions and
plus the special instructions. So for this part, I put "next are instructions for the
overall approach you should take to creating the meme, interpret as best as possible."
And this basic instructions here is this basic instructions setting here. So that
goes into it. So behind the scenes, I'm telling it basically that the user might put some weird
instructions here, interpret as best as possible and do that. And then the special instructions
append is the same idea. I say "next are any special instructions for the image prompt.
For example, if the instructions are the image should be photographic style,
your prompt may append photograph at the end." And this was again,
just through trial and error to get it to follow what I want. And I say "it does not
literally have to match the instructions, but interpret as best as possible."
And then that is where you would put any special image instructions. You could see that the default
is that it should be photographic. And all that put together goes into the system prompt.
And again, nothing in here is what the user types into the actual box that actually gets
sent separately. And again, if you want to look through all of this, it's not too interesting.
I just have a bunch of random functions like getting the settings, getting the API keys,
validating the API keys. I don't think there's anything even worth mentioning
really. So that is it. You can make it as complicated or simple as you want with all
the settings. Hopefully you find it pretty cool. So hopefully you found this pretty fun.
Let me know what you think down in the comments. And don't forget to check out
that Twitter bot too. I'll put that link in the description as well. As always,
if you enjoyed the video, give it a big giant thumbs up for the YouTube algorithm. And if
you want to subscribe, I try to make videos about week, usually Wednesday and Saturday.
If you want to keep watching, the next video I'd recommend is one I
made talking about the F13 through F24 keys that you may have never heard of,
but they're actually kind of still around and still might be useful to you. I'll put
that link right there. So thanks so much for watching and I'll see you in the next one.