Art Generation with DALL-E and Stable Diffusion
Ever wanted to create art like a professional artist? Struggling with creating good quality prompts for DALL-E? PromptxAI Artist library is here to help.
With PromptxAI Artist library you can generate beautiful random art without even writing a prompt! If you have an idea about a concept, you just need to come up with two or more keywords and AuthorAI Artist will generate a prompt for you. If you know exactly what you want to create, AuthorAI Artist will help you refine the prompt with the right painting style, surface, material, even painting subject and origins to add some character to your painting.
Packages and configuration¶
Let's jump right in. To start with let us import PromptAI Artist API. To render the generated art in Jupyter we need the IPython library. Then we can configure a local folder where the generated art will be saved.
from promptxai import artist
from IPython.display import Image
local = 'generated'
prompt = artist.prompt_random_art() print(prompt)
A single candle illuminates a dark, cobweb-filled room, casting eerie shadows that dance on the walls, The in abstract style on pastel medium drawn on concrete surface
If we like the description generated we continue else we can re-run the cell or for more advanced customizations we can also provide some arguments to the function.
prompt = artist.prompt_random_art(words=50, advanced=True) print(prompt)
A painting depicting a peaceful night under a starry sky, seen through a window of a cozy cabin surrounded by luscious green fields, in mythological style on acrylic medium which is still life painting drawn on paper surface from mughal origin
Happy with this description, we go on to generate art using DALL-E model in one line of code.
filename = artist.generate_art(prompt, size='1024x1024', folder=local) print(filename)
generated/A painting depicting a peaceful night under a starry sky, seen through a window of a cozy cabin surrounded by luscious green fields, in mythological style on acrylic medium which is still life painting drawn on paper surface 20230210155926.png
We can now display the generated art saved in our local folder.