Do you want to generate an image by AI? In this article, we see the best AI art generator that will enable you to create artworks easily.
AI art generator is in vogue these days.
And even if this novelty displeases some artists, others take advantage of it to win competitions with these new generation assistants.
This is the case of Jason Allen who won, thanks to the AI Midjourney, the Colorado State Fair contest by generating this work of art:
This high quality image was automatically made by an AI.
Here, I propose you to see the best AI that you can use now to make, you too, works of art!
NightCafé
First, there’s NightCafé, the easiest AI to use.
No account is needed to generate the first 5 images.
You just write what you want to see and you get your image.
You can try NightCafé by clicking here.
Stable Diffusion
Now let’s see a more technical AI: Stable Diffusion.
This one will please developers.
You can test it directly on this link.
Even better.
You can integrate Stable Diffusion, directly into your programs.
HuggingFace
For that, you only need to be able to use the Python language.
You can for example go to Google Colab which provides you with a free Python environment.
You also need to have a GPU at hand.
To activate a free GPU on Colab, go to Run > Change runtime type > GPU.
Then install the following libraries:
!pip install diffusers &> /dev/null
!pip install transformers &> /dev/null
!pip install accelerate &> /dev/null
And uses this code to generate images:
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
import transformers
import torch
model_id = "stabilityai/stable-diffusion-2"
# Use the Euler scheduler here instead
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
prompt = "a pizza rocket flying to Saturn"
image = pipe(prompt).images[0]
image.save("rocket_pizza.png")
You can change the result of the image by writing what you want to see in the prompt
variable.
To see the result, click on the menu on the left, in the folder part and double click on rocket_pizza.png
.
If you want to create new images, don’t forget to change the file name in image.save()
.
Here is the result I got:
It’s a good start.
But we can do better!
Keras
Stable Diffusion can also be used directly with the Machine Learning library Keras.
Here again, we will need a GPU.
To do this, we import the following libraries:
!pip install --upgrade keras-cv &> /dev/null
import time
import keras_cv
from tensorflow import keras
import matplotlib.pyplot as plt
Then, we import the Stable Diffusion model from the keras_cv library (a specific module of Keras to do Computer Vision):
By the way, if your goal is to master Deep Learning - I've prepared the Action plan to Master Neural networks. for you.
7 days of free advice from an Artificial Intelligence engineer to learn how to master neural networks from scratch:
- Plan your training
- Structure your projects
- Develop your Artificial Intelligence algorithms
I have based this program on scientific facts, on approaches proven by researchers, but also on my own techniques, which I have devised as I have gained experience in the field of Deep Learning.
To access it, click here :
Now we can get back to what I was talking about earlier.
model = keras_cv.models.StableDiffusion(img_width=512, img_height=512)
We define a function to display our result:
def plot_images(images):
plt.figure(figsize=(20, 20))
for i in range(len(images)):
ax = plt.subplot(1, len(images), i + 1)
plt.imshow(images[i])
plt.axis("off")
And finally we can create our image!
images = model.text_to_image(
"Paris in Heaven, fantasy art, "
"light blue color, high quality, highly detailed, elegant, sharp focus, "
"concept art, character concepts, digital painting, mystery, adventure",
batch_size=3,
)
plot_images(images)
The result is much better than the previous one 🏆
Don’t hesitate to detail your request, Stable Diffusion will understand it and interpret it better !
Dall-E 2
Next, we have Dall-E 2.
Here, compared to the previous AI, we are a level higher.
With Dall-E, you will create images much more faithful to your request.
On top of that, the quality is quite different.
I let you judge for yourself:
You can use Dall-E 2 by creating an account on OpenAI.
Dall-E also allows you to integrate AI image generation in your programs, but you will need to get an API key after you have created your account.
Midjourney
Finally, let’s look at the most popular Artificial Intelligence of all: Midjourney.
Why the most popular?
It’s free, easy to use and, personally, it’s with this AI art generator that I got my best results.
To use it you just have to follow this link.
Click on join the beta.
This will send you to Discord. Don’t worry, you don’t need an account.
You can use the AI easily as a guest 🔥
Now it’s your time to get started.
And don’t forget to post the link to the artworks you create in comments!
I wish you a great exploration of art generator AI.
And if you want to try other kinds of AI designed for the public, I invite you to see our articles on :
See you soon on Inside Machine Learning 😉
source :
- Keras – High-performance image generation using Stable Diffusion in KerasCV
One last word, if you want to go further and learn about Deep Learning - I've prepared for you the Action plan to Master Neural networks. for you.
7 days of free advice from an Artificial Intelligence engineer to learn how to master neural networks from scratch:
- Plan your training
- Structure your projects
- Develop your Artificial Intelligence algorithms
I have based this program on scientific facts, on approaches proven by researchers, but also on my own techniques, which I have devised as I have gained experience in the field of Deep Learning.
To access it, click here :