# Generating AI Images from your own PC

You want to create AI-generated images. You’ve probably signed up with Dall-E, or Bing, or Midjourney. You’ve created some cool stuff. If you’re reading this, you want to generate those images on your *own computer*. There is no website or discord to deal with. Running locally on your machine.

Why would anyone do this? Here are a few reasons:

* It’s educational
    
* You can generate as many images as you want
    
* It’s free
    

With this tutorial’s help, you can generate images with AI on your own computer with [Stable Diffusion](https://github.com/Stability-AI/stablediffusion).

Let’s get started.

## Step 1: Requirements

There are some requirements for doing this on your own machine. It must have:

### Hardware:

* A modern AMD or Intel CPU
    
* 16 Gigabytes of RAM
    
* SATA or NVMe solid state drive
    
* NVidia GeForce GPU with at least 8 gigabytes of GDDR6 RAM
    

### Software:

* You must have Python installed ([How to install Python in Windows 11](https://www.pythonhelp.org/learn/introduction/setting-up-development-environment-windows/)).
    
* You can use Anaconda if you want ([How to install Anaconda in Windows 11](https://www.jeremymorgan.com/tutorials/python-tutorials/how-to-install-anaconda-windows/)).
    
* You must have Git Installed ([How to install Git in Windows 11](https://www.simplilearn.com/tutorials/git-tutorial/git-installation-on-windows)).
    
* You need an account at [HuggingFace](https://huggingface.co/) (it’s a free account)
    

Check your Python version to make sure it’s up to snuff:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/2165b556678b83c8a3ef8f13bff8bbffd125f8f7/df3d3/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-00.webp align="left")

And make sure Git is installed:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/c2f1dcc2497f0f420406760117484bf43d8edfa0/d99eb/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-01.webp align="left")

And you’re ready to go.

## Step 2: Install Stable Diffusion Web UI

Create a folder somewhere where you want the software to live. Go to that folder:

`cd /your/project/directory`

(for me it’s C:\\Users\\jerem\\Projects)

Then clone the repository:

`git clone` [`https://github.com/AUTOMATIC1111/stable-diffusion-webui.git`](https://github.com/AUTOMATIC1111/stable-diffusion-webui.git) `stable-diffusion-demo`

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/f1034dc1c6ce5bc42f6ac2b7f265f2d50a474cc0/b57af/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-02.webp align="left")

You should see the folder you just created:

`stable-diffusion-demo`

Now we need to go into the models folder:

`cd stable-diffusion-demo\models\Stable-diffusion`

It should look like this:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/a76eccef4acadd6c6db176bd1b7ca92bee17ddc9/20598/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-03.webp align="left")

This is where we’ll put the Stable Diffusion models when we download them.

## Step 3: Download the Model from Hugging Face

Next, we need a stable diffusion model, and we can get one from [Hugging Face](https://huggingface.co/).

Let’s try the [v1-5-pruned-emaonly.ckpt](https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt) model. Download it to the `stable-diffusion-demo/models/Stable-diffusion` folder:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/837589a9170d2be610ac837120bb7e7f5d2363d9/45ff3/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-04.webp align="left")

It might take a while to download (4GB at the time of this article).

Ok, now.. you’re ready to run the web app!

### Step 4: Run the Stable Diffusion Web UI

At your command prompt, make sure you’re in the folder you created in step 2.

`cd stable-diffusion-demo`

Then run `webui-user.bat`

The first time you do this, it will install everything needed, so it may take a few minutes.

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/2920c9c72da639463ba53cd3b6b18a4333acd423/62f55/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-05.webp align="left")

Once it’s completed, your command prompt will look something like this:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/fb54d7872bdb841a4b3f369c9cb8e82b61b89e3c/ef950/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-06.webp align="left")

And the web server will be up and running.

### Step 5: The Web Interface

Load up the following URL in your web browser:

[`http://127.0.0.1:7860/`](http://127.0.0.1:7860/)

It may load up automatically in the browser as well. But you’ll see a full web interface you can use to generate images:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/9aa3e3236917a548f6f710412ca8d23961b997cc/d6d42/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-07.webp align="left")

Awesome! Let’s try it out!

The sampling method is the first thing you might notice in the generation tab. There are a LOT of them:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/edbdf0a6363469508b2969e8df57de82f2829e08/89cf9/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-08.webp align="left")

I suggest spending some time adjusting and playing with this. But for now, we’ll use `DPM++ 2M Karras` that’s selected as default.

Here are some settings to pay attention to:

* **Sampling steps** - This will repeatedly try to improve the image as it generates. Low values will be low quality, but fast. High values will be higher quality and slower to generate.
    
* **Width and height** - These will control the size of the generated image. Like above, larger images will look better and take longer.
    
* **CFG Scale** - This will change how “random” the result is. A higher value will attempt to take the prompt as literally as possible. Lower values will produce more creative results.
    
* **Seed** - This value determines the output of the random number generator. You can use it as a key. If you use the same prompt with the same seed, you’ll get the same image. You can create many variations from the same “key”.
    

So today, I will leave everything at the default settings. The only thing I will do is create a `seed` to progressively improve the same image as we go.

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/4d9c9c4d1203bd6dcc828cd8290941a484891228/b494d/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-09.webp align="left")

And I’ll add in a prompt to make something silly.

‘a photo of an anthropomorphic frog riding a skateboard in Times Square\`

It took about a minute to generate this image. (Laptop with RTX 3060)

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/211861faf97f96a3ca908bc9ba70d4459d53cb94/303ca/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-10.webp align="left")

And it’s pretty cool! It’s impressive, considering it’s being run on my local machine. Let’s improve this image!

### Step 6: Improving Images

Here’s the actual image I produced:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/cf45eea77cb7ade627ac65068687276f72748f18/cde76/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-11.webp align="left")

Let’s mess with the settings to see what we can improve. Let’s change the Sampling steps. This is how often it goes through the image and tries to improve it. The default setting is `20`. Let’s set it to the maximum number of `150`. This will take more than a minute to produce now.

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/485d519cdcafe319d851874e2800002e16eb7a6b/2e310/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-12.webp align="left")

I will leave the prompt and the seed the same and click “Generate” again.

I’ll warn you: it can work the GPU when you do this.

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/556e5962c8ff7d50e0476946a150ec7aa3b67cd7/0ca64/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-13.webp align="left")

Here is the result after **150** sampling steps:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/7054d90a1f483164bb9dda770f70c0aa31a8b907/77895/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-14.webp align="left")

So it’s certainly different, but not in a significant way. We don’t want to scale up our generating time by 10x for this small change. I’ll change it back to `20` and change `CFG Scale` to `5`. This will make the model more “creative”.

Here are the settings:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/ddd5ab9ab7493d74782ff6d2931d8bc770a30a0a/99819/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-15.webp align="left")

And here is the result:

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/d77e6a8879cb925ae0c6cd12152a6e11e6cefdf1/ce11f/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-16.webp align="left")

Ok, that’s too creative. But you can see the changes that occur when you adjust it. You can also use different sampling methods as well:

#### DPM++ SDE Karras

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/d3ab144195a526361b2e571d85b8060ce6aa1eb2/c24f2/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-17.webp align="left")

This model’s output is kind of neat because it shows the frog skateboarding better.

#### Euler

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/ee55b16362b7d63dd0e3608a2d1d29031be1337a/1cd62/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-18.webp align="left")

#### DPM++ 3M SDE

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/4cd78ca3bf1784f2a9eab03476e80737918caf10/8a72b/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-19.webp align="left")

When attempting to draw things in cartoon, especially anthropomorphic models, it can come out very bizarre.

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/5ac40456a9a656c01cfd3afcf6c9c4575a183332/758fe/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-20.webp align="left")

But that’s all there is to it!

## Conclusion

In this tutorial, we:

* Installed the Stable Diffusion Web UI
    
* Downloaded a model
    
* Generated AI images
    
* Modified the output
    

All from our local machine! Here are the benefits and downsides of this method compared to something like Midjourney:

Pros:

* It’s free!
    
* Generate as many images as you like
    
* Runs locally and is not dependent on an internet connection
    

Cons:

* Nowhere near the level of quality as Midjourney and others
    
* You need a good machine to run this
    
* It may take longer to generate images
    

![“How to Install Free AI image Generator”](https://d33wubrfki0l68.cloudfront.net/c9881832c004cf75e5e5469a553a356d8d7a56f4/950e0/images/tutorials/generative-ai/how-to-create-ai-images/how-to-create-ai-images-21.webp align="left")

So there you have it! Now, you can generate images on your machine and show your creations to the world. We are barely getting started with the possibilities available from this model. We’ll explore it more in the coming weeks.

If you have any questions, feel free to reach out!

– Jeremy

Questions? Comments? [Yell at me!](https://x.com/intent/follow?screen_name=JeremyCMorgan)

**If you're into Computer Vision and other cool AI tech, you should subscribe to my** [**AI Architect Newsletter**](https://mailchi.mp/4961a415a64f/learn-ai-newsletter) **to keep up with the latest stuff!**
